1 Star 0 Fork 200

tianyue/yshop-gin

forked from guchengwuyue/yshop-gin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"log"
"net/http"
"time"
"yixiang.co/go-mall/app/listen"
"yixiang.co/go-mall/app/models"
"yixiang.co/go-mall/pkg/base"
"yixiang.co/go-mall/pkg/global"
"yixiang.co/go-mall/pkg/jwt"
"yixiang.co/go-mall/pkg/logging"
"yixiang.co/go-mall/pkg/redis"
"yixiang.co/go-mall/pkg/wechat"
"yixiang.co/go-mall/routers"
)
func init() {
global.YSHOP_VP = base.Viper()
global.YSHOP_LOG = base.SetupLogger()
models.Setup()
logging.Setup()
redis.Setup()
jwt.Setup()
listen.Setup()
wechat.InitWechat()
}
// @title gin-shop API
// @version 1.0
// @description gin-shop商城后台管理系统
// @termsOfService https://gitee.com/guchengwuyue/gin-shop
// @license.name apache2
func main() {
gin.SetMode(global.YSHOP_CONFIG.Server.RunMode)
routersInit := routers.InitRouter()
endPoint := fmt.Sprintf(":%d", global.YSHOP_CONFIG.Server.HttpPort)
maxHeaderBytes := 1 << 20
server := &http.Server{
Addr: endPoint,
Handler: routersInit,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: maxHeaderBytes,
}
global.YSHOP_LOG.Info("[info] start http server listening %s",endPoint)
log.Printf("[info] start http server listening %s", endPoint)
fmt.Printf("欢迎使用yshop-gin,官网地址:https://www.yixiang.co\n")
server.ListenAndServe()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/tybj88/yshop-gin.git
git@gitee.com:tybj88/yshop-gin.git
tybj88
yshop-gin
yshop-gin
master

搜索帮助