12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package init_serve
- import (
- "github.com/gin-gonic/gin"
- "github.com/swaggo/gin-swagger"
- "github.com/swaggo/gin-swagger/swaggerFiles"
- _ "hongze/fms_api/docs"
- "hongze/fms_api/global"
- "hongze/fms_api/middleware"
- "hongze/fms_api/routers"
- )
- func InitRouter() (r *gin.Engine) {
-
- gin.SetMode(global.CONFIG.Serve.RunMode)
-
- r = gin.Default()
- r.Use(middleware.Cors())
-
- r.Use(middleware.Recover())
-
- r.Use(middleware.Common())
-
- r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
- rBase := r.Group("api/")
-
- systemGroup := rBase.Group("system/")
- resourceGroup := rBase.Group("resource/")
- routers.InitSystem(systemGroup)
- routers.InitAuth(rBase)
- routers.InitResource(resourceGroup)
-
- crmGroup := rBase.Group("crm/")
- routers.InitCrm(crmGroup)
-
- contractGroup := rBase.Group("contract/")
- routers.InitContract(contractGroup)
-
- censusGroup := rBase.Group("census/")
- routers.InitCensus(censusGroup)
-
- routers.InitStatistic(rBase)
- return
- }
|