12345678910111213141516171819202122 |
- package app
- import (
- middleware "Ic_ouath/app/middlewares"
- "Ic_ouath/app/routers"
- "Ic_ouath/configs"
- _ "Ic_ouath/docs"
- "github.com/gin-gonic/gin"
- swaggerFiles "github.com/swaggo/files"
- ginSwagger "github.com/swaggo/gin-swagger"
- )
- func InitRouter() error {
- engine := gin.New()
- //记录日志
- // engine.Use(middleware.LoggerToFile())
- engine.Use(middleware.Cors())
- engine.GET("/swagger/*any", ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "NAME_OF_ENV_VARIABLE"))
- gin.SetMode(configs.Config.GetString("server.mode"))
- routers.UserRouter(engine)
- return engine.Run(configs.Config.GetString("server.port"))
- }
|