123456789101112131415161718192021222324252627 |
- package init_serve
- import (
- _ "eta_gn/eta_bridge/docs"
- "eta_gn/eta_bridge/global"
- "eta_gn/eta_bridge/middleware"
- "eta_gn/eta_bridge/routers"
- "github.com/gin-gonic/gin"
- )
- // InitRouter 初始化路由
- func InitRouter() (r *gin.Engine) {
- gin.SetMode(global.CONFIG.Serve.RunMode)
- r = gin.Default()
- r.Use(middleware.Cors())
- r.Use(middleware.Recover())
- common := middleware.Common{}
- r.Use(common.RequestLog)
- rBase := r.Group("api/")
- routers.InitAuth(rBase)
- routers.InitIndexData(rBase)
- routers.InitGn(rBase)
- return
- }
|