You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.2 KiB

  1. package initRouter
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/swaggo/gin-swagger"
  5. "github.com/swaggo/gin-swagger/swaggerFiles"
  6. _ "main/docs"
  7. "main/middleware"
  8. "main/router"
  9. )
  10. //初始化总路由
  11. func InitRouter() *gin.Engine {
  12. var Router = gin.Default()
  13. //Router.Use(middleware.LoadTls()) // 打开就能玩https了
  14. Router.Use(middleware.Logger()) // 如果不需要日志 请关闭这里
  15. Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
  16. ApiGroup := Router.Group("") // 方便统一添加路由组前缀 多服务器上线使用
  17. //Router.Use(middleware.Logger())
  18. router.InitUserRouter(ApiGroup) // 注册用户路由
  19. router.InitBaseRouter(ApiGroup) // 注册基础功能路由 不做鉴权
  20. router.InitMenuRouter(ApiGroup) // 注册menu路由
  21. router.InitAuthorityRouter(ApiGroup) // 注册角色路由
  22. router.InitApiRouter(ApiGroup) // 注册功能api路由
  23. router.InitFileUploadAndDownloadRouter(ApiGroup) // 文件上传下载功能路由
  24. router.InitWorkflowRouter(ApiGroup) // 工作流相关路由
  25. router.InitCasbinRouter(ApiGroup)
  26. return Router
  27. }