/* * @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/controllers" "go.mod/web/middleware" ) func Configure(b *bootstrap.Bootstrapper) { //service加载 ProjectAccountService := services.NewProjectAccountService() LoginService := services.NewLoginService() ProjectService := services.NewProjectService() FolderService := services.NewFoldertService() //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(FolderService) 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)) }