1234567891011121314151617181920212223 |
- package app
- import (
- "github.com/gin-gonic/gin"
- swaggerFiles "github.com/swaggo/files"
- ginSwagger "github.com/swaggo/gin-swagger"
- "lot_interlligentControl/app/middlewares"
- "lot_interlligentControl/app/routers"
- _ "lot_interlligentControl/docs"
- "lot_interlligentControl/global"
- )
- func InitRouter() error {
- engine := gin.New()
- engine.GET("/swagger/*any", ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "NAME_OF_ENV_VARIABLE"))
- engine.Use(middlewares.LoggerToFile())
- engine.Use(middlewares.Cors())
- engine.Use(middlewares.LoginMiddleware())
- routers.ShopInItRouter(engine)
- routers.ServiceNodeRouter(engine)
- routers.AdminInirRouter(engine)
- return engine.Run(global.ServerSetting.Port)
- }
|