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.
33 lines
464 B
33 lines
464 B
10 months ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"backend/app"
|
||
|
"backend/tool"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"github.com/spf13/viper"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
// main
|
||
|
func main() {
|
||
|
// 配置加载
|
||
|
tool.LoadConfig()
|
||
|
|
||
|
// 设置应用模式
|
||
|
tool.SetMode()
|
||
|
|
||
|
// 初始化数据库连接池
|
||
|
if err := tool.InitDB(); err != nil {
|
||
|
log.Fatalln(err)
|
||
|
}
|
||
|
|
||
|
// 初始化路由引擎
|
||
|
router := gin.Default()
|
||
|
|
||
|
// 设置路由
|
||
|
app.SetRouter(router)
|
||
|
|
||
|
// 启动监听
|
||
|
router.Run(viper.GetString("app.addr"))
|
||
|
}
|