router.go 451 B

123456789101112131415161718192021222324
  1. package init_serve
  2. import (
  3. "eta_gn/eta_obs/controller"
  4. _ "eta_gn/eta_obs/docs"
  5. "eta_gn/eta_obs/global"
  6. "eta_gn/eta_obs/middleware"
  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. // 统一转到obs方法
  16. obs := controller.ObsController{}
  17. r.GET("/*path", obs.File)
  18. return
  19. }