router.go 475 B

12345678910111213141516171819202122232425
  1. package init_serve
  2. import (
  3. "eta_gn/eta_bridge/global"
  4. "eta_gn/eta_bridge/middleware"
  5. "eta_gn/eta_bridge/routers"
  6. "github.com/gin-gonic/gin"
  7. )
  8. func InitRouter() (r *gin.Engine) {
  9. gin.SetMode(global.CONFIG.Serve.RunMode)
  10. r = gin.Default()
  11. r.Use(middleware.Cors())
  12. r.Use(middleware.Recover())
  13. common := middleware.Common{}
  14. r.Use(common.RequestLog)
  15. rBase := r.Group("api/")
  16. routers.InitAuth(rBase)
  17. routers.InitIndexData(rBase)
  18. routers.InitGn(rBase)
  19. return
  20. }