router.go 542 B

123456789101112131415161718192021222324
  1. package init_serve
  2. import (
  3. _ "eta/eta_docs/docs"
  4. "eta/eta_docs/global"
  5. "eta/eta_docs/middleware"
  6. "eta/eta_docs/routers"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // InitRouter 初始化路由
  10. func InitRouter() (r *gin.Engine) {
  11. gin.SetMode(global.CONFIG.Serve.RunMode)
  12. r = gin.Default()
  13. r.Use(middleware.Cors())
  14. r.Use(middleware.Recover())
  15. rBase := r.Group("api/")
  16. routers.InitVersionUpdateLog(rBase) // 版本更新日志
  17. routers.InitHelpDoc(rBase) // 帮助文档
  18. routers.InitEtaTrainingVideo(rBase) // 培训视频
  19. return
  20. }