123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /*
- * @description: 路由配置
- * @Author: CP
- * @Date: 2020-08-23 21:32:54
- * @FilePath: \construction_management\web\routes\routes.go
- */
- package routes
- import (
- "github.com/kataras/iris/v12/mvc"
- "go.mod/bootstrap"
- "go.mod/services"
- "go.mod/web/api"
- "go.mod/web/controllers"
- "go.mod/web/middleware"
- )
- func Configure(b *bootstrap.Bootstrapper) {
- //service加载
- ProjectAccountService := services.NewProjectAccountService()
- LoginService := services.NewLoginService()
- ProjectService := services.NewProjectService()
- TreeService := services.NewTreeService()
- //CSRF相关
- b.Use(middleware.SetCsrf)
- //b.Party("/", protect)
- //protect := NewCsrf()
- //登录相关
- //login := mvc.New(b.Party("/", protect))
- login := mvc.New(b.Party("/"))
- login.Register(ProjectAccountService)
- login.Register(LoginService)
- login.Handle(new(controllers.LoginController))
- // todolist相关
- todo := mvc.New(b.Party("/todolist"))
- todo.Router.Use(middleware.SessionsAuth)
- todo.Handle(new(controllers.TodoController))
- // 合同管理
- contract := mvc.New(b.Party("/contract"))
- contract.Router.Use(middleware.SessionsAuth)
- contract.Handle(new(controllers.ContractController))
- // 安全巡检
- //用户相关
- account := mvc.New(b.Party("/account"))
- account.Register(ProjectAccountService)
- account.Router.Use(middleware.SessionsAuth)
- account.Handle(new(controllers.AccountController))
- // 项目相关
- project := mvc.New(b.Party("/project"))
- project.Router.Use(middleware.SessionsAuth)
- project.Register(TreeService)
- project.Register(ProjectService)
- project.Handle(new(controllers.ProjectController))
- //标段相关
- bidsection := mvc.New(b.Party("/bidsection"))
- bidsection.Register(ProjectService)
- bidsection.Router.Use(middleware.SessionsAuth)
- bidsection.Handle(new(controllers.BidsectionController))
- // 接口相关
- // 登陆接口
- apiLogin := mvc.New(b.Party("/api/login"))
- apiLogin.Register(ProjectAccountService)
- apiLogin.Register(LoginService)
- //apiLogin.Router.Use(middleware.JwtAuth().Serve)
- apiLogin.Handle(new(api.LoginApi))
- // TreeNode相关接口
- apiTree := mvc.New(b.Party("/api/tree"))
- apiTree.Register(TreeService)
- apiTree.Register(ProjectService)
- apiTree.Router.Use(middleware.JwtAuth().Serve)
- apiTree.Handle(new(api.TreeApi))
- // 项目相关接口
- apiProject := mvc.New(b.Party("/api/project"))
- apiProject.Register(ProjectService)
- apiProject.Router.Use(middleware.JwtAuth().Serve)
- apiProject.Handle(new(api.ProjectApi))
- }
|