You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
568 B

2 months ago
package main
import (
2 months ago
"ginCms/handlers"
"ginCms/models"
2 months ago
"ginCms/utils"
"github.com/spf13/viper"
2 months ago
)
func main() {
2 months ago
// 解析配置
utils.ParseConfig()
2 months ago
// 设置应用模式
utils.SetMode()
2 months ago
// 设置日志
utils.SetLogger()
2 months ago
2 months ago
// 初始化数据库连接
utils.InitDB()
// 初始化模型
models.Init()
2 months ago
2 months ago
// 初始化路由引擎
r := handlers.InitEngine()
2 months ago
// 使用logger输出应用日志
utils.Logger().Info("service is listening", "addr", viper.GetString("app.addr"))
2 months ago
r.Run(viper.GetString("app.addr")) // 监听并在 0.0.0.0:8080 上启动服务
2 months ago
}