1 Star 0 Fork 41

hamyct / BaiZe

forked from danny / BaiZe 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 700 Bytes
一键复制 编辑 原始数据 按行查看 历史
danny 提交于 2021-12-01 22:53 . 添加定时任务
package main
import (
"baize/app/common/mysql"
"baize/app/common/redis"
"baize/app/routes"
"baize/app/setting"
"baize/app/utils"
"baize/app/utils/logger"
"fmt"
"os"
)
func main() {
var filePath string
if len(os.Args) <= 1 {
filePath = "./config.yaml"
} else {
filePath = os.Args[1]
}
//1.加载配置
setting.Init(filePath)
//2.初始化日志
logger.Init()
//3.初始化MySQL
mysql.Init()
defer mysql.Close() // 程序退出关闭数据库连接
//4.初始化Redis
redis.Init()
defer redis.Close()
//5.初始化Utils
utils.Init()
//6.注册路由启动服务
r := routes.Init()
err := r.Run(fmt.Sprintf(":%d", setting.Conf.Port))
if err != nil {
panic(err)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/hamyct/BaiZe.git
git@gitee.com:hamyct/BaiZe.git
hamyct
BaiZe
BaiZe
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891