1 Star 0 Fork 1

nobita / eago

forked from code4go / eago 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.go 682 Bytes
一键复制 编辑 原始数据 按行查看 历史
darifo 提交于 2021-01-25 16:11 . 初始化初次提交
package main
import (
"gitee.com/g2w/eago/config"
"gitee.com/g2w/eago/database"
"gitee.com/g2w/eago/middleware"
"gitee.com/g2w/eago/router"
"github.com/gin-gonic/gin"
)
func main() {
// 配置文件加载
config.Init()
// 链接数据库
database.Conn()
// 生产环境开启
if config.AppConfig.GIN.Dev == false {
gin.SetMode(gin.ReleaseMode)
}
// 创建空白服务器
s := gin.New()
// 全局中间件注入
s.Use(middleware.Cors())
s.Use(middleware.Logger2File())
s.Use(middleware.Recovery())
// 路由载入
router.LoadRouters(s)
// 监听服务
addr := config.AppConfig.GIN.Host
port := config.AppConfig.GIN.Port
_ = s.Run(addr + ":" + port)
}
1
https://gitee.com/nobita58/eago.git
git@gitee.com:nobita58/eago.git
nobita58
eago
eago
master

搜索帮助