func loadNS() { auth := getAuth() education := education.Get() institutions := institutions.Get() repositories := repositories.Get() beego.AddNamespace(auth) beego.AddNamespace(education) beego.AddNamespace(institutions) beego.AddNamespace(repositories) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/moment", beego.NSInclude( &controllers.MomentController{}, ), ), beego.NSNamespace("/comment", beego.NSInclude( &controllers.CommentController{}, ), ), beego.NSNamespace("/like", beego.NSInclude( &controllers.LikeController{}, ), ), beego.NSNamespace("/block", beego.NSInclude( &controllers.BlockController{}, ), ), beego.NSNamespace("/unshare", beego.NSInclude( &controllers.UnshareController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/comments", beego.NSInclude( &controllers.CommentsController{}, ), ), beego.NSNamespace("/posts", beego.NSInclude( &controllers.PostsController{}, ), ), beego.NSNamespace("/users", beego.NSInclude( &controllers.UsersController{}, ), ), beego.NSNamespace("/jwt", beego.NSInclude( &controllers.JwtController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/patient", beego.NSRouter("/:id", &controllers.PatientController{}, "get:Get"), ), ) beego.AddNamespace(ns) }
func main() { ns := beego.NewNamespace("/js", beego.NSInclude(&controllers.NewsController{}), ) beego.AddNamespace(ns) app := beego.Include(&controllers.NewsVController{}) app.Run() }
func init() { // 注册路由 beego.Router("/", &controllers.ViewController{}, "Get:Index;Post:Login") beego.Router("/signOut", &controllers.ViewController{}, "Get:SignOut") beego.Router("/error", &controllers.ViewController{}, "Get:Error") api := beego.NewNamespace("/api", beego.NSNamespace("/student", beego.NSInclude( &controllers.APIStudentController{}, ), ), beego.NSNamespace("/admin", beego.NSInclude( &controllers.APIAdminController{}, ), ), beego.NSNamespace("/teacher", beego.NSInclude( &controllers.APITeacherController{}, ), ), ) view := beego.NewNamespace("/view", beego.NSNamespace("/student", beego.NSInclude( &controllers.ViewStudentController{}, ), ), beego.NSNamespace("/admin", beego.NSInclude( &controllers.ViewAdminController{}, ), ), beego.NSNamespace("/teacher", beego.NSInclude( &controllers.ViewTeatherController{}, ), ), ) beego.AddNamespace(api) beego.AddNamespace(view) AddRouterFilter() }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/post", beego.NSInclude( &controllers.PostController{}, ), ), ) beego.AddNamespace(ns) }
func init() { beego.Router("/", &controllers.MainController{}) beego.Router("/login", &controllers.MainController{}, "get:LoginPage") beego.Router("/validUser", &controllers.MainController{}, "post:ValidUser") beego.Router("/author", &controllers.UserControlelr{}, "get:Author") nsApi := beego.NewNamespace("/i", beego.NSRouter("/posts", &controllers.PostController{}, "get:Posts"), beego.NSRouter("/posts/list/:page", &controllers.PostController{}, "get:ListPosts"), beego.NSRouter("/posts/:id", &controllers.PostController{}, "get:OnePost"), beego.NSRouter("/submitMsg", &controllers.PostController{}, "post:SubmitMsg"), ) beego.AddNamespace(nsApi) nsAdmin := beego.NewNamespace("admin", beego.NSRouter("/main", &controllers.MainController{}, "get:Main"), beego.NSRouter("/logout", &controllers.MainController{}, "get:Logout"), beego.NSRouter("/user", &controllers.MainController{}, "get:UserPage"), beego.NSRouter("/userUpdate", &controllers.MainController{}, "post:UserUpdate"), beego.NSRouter("/post", &controllers.MainController{}, "get:PostPage"), beego.NSRouter("/post/save", &controllers.MainController{}, "post:SavePost"), beego.NSRouter("/post/delete/:id", &controllers.MainController{}, "delete:DeletePost"), beego.NSRouter("/message", &controllers.MainController{}, "get:MessagePage"), beego.NSRouter("/message/list/:page", &controllers.MainController{}, "get:ListMessage"), beego.NSRouter("/message/delete/:id", &controllers.MainController{}, "delete:DeleteMessage"), beego.NSRouter("/message/reply", &controllers.MainController{}, "post:ReplyMessage"), beego.NSRouter("/write", &controllers.MainController{}, "get:WritePage"), beego.NSRouter("/imgUp", &controllers.MainController{}, "post:ImgUp"), beego.NSRouter("/resetPwd", &controllers.MainController{}, "post:ResetPwd"), ) beego.AddNamespace(nsAdmin) var checkUser = func(ctx *context.Context) { if strings.HasPrefix(ctx.Request.RequestURI, "/admin") { _, ok := ctx.Input.Session("inote").(int) if !ok && ctx.Request.RequestURI != "/login" { ctx.Redirect(302, "/login") } } } beego.InsertFilter("/*", beego.BeforeRouter, checkUser) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/crawl", beego.NSInclude( &controllers.ObjectController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/app", beego.NSInclude( &controllers.AppController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/auth", beego.NSInclude( &controllers.AuthenticationController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/admin", beego.NSNamespace("/t_authority", beego.NSInclude( &controllers.TAuthorityController{}, ), ), beego.NSNamespace("/t_board", beego.NSInclude( &controllers.TBoardController{}, ), ), beego.NSNamespace("/t_message", beego.NSInclude( &controllers.TMessageController{}, ), ), beego.NSNamespace("/t_pin", beego.NSInclude( &controllers.TPinController{}, ), ), beego.NSNamespace("/t_profile", beego.NSInclude( &controllers.TProfileController{}, ), ), beego.NSNamespace("/t_role", beego.NSInclude( &controllers.TRoleController{}, ), ), beego.NSNamespace("/t_user", beego.NSInclude( &controllers.TUserController{}, ), ), ), beego.NSRouter("/signup", &controllers.TUserController{}, "*:SignUp"), beego.NSRouter("/signin", &controllers.TUserController{}, "*:SignIn"), beego.NSRouter("/signout", &controllers.TUserController{}, "*:SignOut"), beego.NSRouter("/upload", &controllers.TUserController{}, "post:Upload"), beego.NSRouter("/recommend", &controllers.TUserController{}, "*:Recommend"), beego.NSRouter("/", &controllers.MainController{}, "*:Index"), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/manage", beego.NSInclude( &controllers.ManageController{}, ), ), ) beego.AddNamespace(ns) }
// Load tells the framework to load the addresses for the router func Load() { developer := beego.NewNamespace("/developer", beego.NSRouter("", &developer.Home{}, "GET:Display"), data.Get(), api.Get(), tools.Get(), ) beego.AddNamespace(developer) }
func init() { beego.Router("/", &controllers.MainController{}, "get:Home") ns := beego.NewNamespace("/v1", beego.NSNamespace("/posts", beego.NSInclude( &controllers.PostController{}, ), ), ) beego.AddNamespace(ns) }
func ConfigRoutes() { //owl-protal-routes portal := beego.NewNamespace("/api/v1/portal", beego.NSGet("/notallowed", func(ctx *context.Context) { ctx.Output.Body([]byte("notAllowed")) }), beego.NSRouter("/eventcases/get", &PortalController{}, "get:EventCasesGet;post:EventCasesGet"), beego.NSRouter("/events/get", &PortalController{}, "get:EventGet;post:EventGet"), beego.NSRouter("/eventcases/close", &PortalController{}, "get:ColseCase;post:ColseCase;put:ColseCase"), beego.NSRouter("/tpl/count", &PortalController{}, "get:CountNumOfTlp;post:CountNumOfTlp"), ) beego.AddNamespace(portal) }
func ConfigRoutes() { //owl-protal-routes dashboard := beego.NewNamespace("/api/v1/dashboard", beego.NSGet("/notallowed", func(ctx *context.Context) { ctx.Output.Body([]byte("notAllowed")) }), beego.NSRouter("/endpoints", &DashBoardController{}, "get:EndpRegxqury;post:EndpRegxqury"), beego.NSRouter("/endpointcounters", &DashBoardController{}, "get:CounterQuery;post:CounterQuery"), ) hostgroup := beego.NewNamespace("/api/v1/hostgroup", beego.NSGet("/notallowed", func(ctx *context.Context) { ctx.Output.Body([]byte("notAllowed")) }), beego.NSRouter("/query", &DashBoardController{}, "get:HostGroupQuery;post:HostGroupQuery"), beego.NSRouter("/hosts", &DashBoardController{}, "get:HostsQueryByHostGroups;post:HostsQueryByHostGroups"), beego.NSRouter("/hostgroupscounters", &DashBoardController{}, "get:CounterQueryByHostGroup;post:CounterQueryByHostGroup"), beego.NSRouter("/count", &DashBoardController{}, "get:CountNumOfHostGroup;post:CountNumOfHostGroup"), ) beego.Router("/ops/endpoints", &DashBoardController{}, "get:EndpRegxquryForOps") beego.AddNamespace(dashboard) beego.AddNamespace(hostgroup) }
func init() { ns := beego.NewNamespace("/v1", beego.NSAfter(log_info), beego.NSRouter("/", &controllers.MainController{}), beego.NSRouter("/test", &controllers.TestController{}), beego.NSRouter("/status", &controllers.StatusController{}, "get:Any;post:Any"), beego.NSRouter("/matrix", &controllers.MatrixController{}), beego.NSRouter("/note:key([0-9]+).html", &controllers.TagController{}), beego.NSRouter("/article_:key([0-9]+).html", &controllers.BlogController{}, "get:ShowBlog"), beego.NSNamespace("/blog", beego.NSRouter("/", &controllers.BlogController{}, "get:ShowList;post:Post"), ), beego.NSNamespace("/tag", beego.NSRouter("/", &controllers.TagController{}), beego.NSRouter("/:key([0-9]+).html", &controllers.TagController{}), ), beego.NSNamespace("/msg", beego.NSRouter("/", &controllers.MessageController{}), beego.NSRouter("/leave", &controllers.MessageController{}, "post:Leave"), ), beego.NSNamespace("/admin", beego.NSRouter("/", &controllers.MainController{}), beego.NSNamespace("/blog", beego.NSRouter("/new", &controllers.BlogController{}, "post:NewBlog;get:AddBlog"), beego.NSRouter("/", &controllers.BlogController{}, "get:ShowEditList"), beego.NSRouter("/:key([0-9]+).html", &controllers.BlogController{}, "get:EditBlog"), ), ), ) // For API ns2 := beego.NewNamespace("v2", beego.NSBefore(auth), beego.NSRouter("/", &controllers.MainController{}), ) beego.AddNamespace(ns) beego.AddNamespace(ns2) }
func init() { if beego.BConfig.RunMode == "dev" { beego.BConfig.WebConfig.DirectoryIndex = true beego.BConfig.WebConfig.StaticDir["/doc"] = "swagger" } ns := beego.NewNamespace("/v1.0", beego.NSNamespace("/auth", beego.NSInclude(&controllers.AuthController{})), beego.NSNamespace("/user", beego.NSInclude(&controllers.UserController{})), beego.NSNamespace("/host", beego.NSInclude(&controllers.HostController{})), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/cddapi/SpeCpMobile", beego.NSNamespace("/get_sites_status", beego.NSInclude( &controllers.SitesStatusController{}, ), ), beego.NSNamespace("/user", beego.NSInclude( &controllers.UserController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/ai", beego.NSInclude( &controllers.AIController{}, ), ), beego.NSNamespace("/webchat", beego.NSInclude( &controllers.WebChatController{}, ), ), ) beego.AddNamespace(ns) }
// Load tells the framework to load the addresses for the router func Load() { accountNS := beego.NewNamespace("/account", beego.NSRouter("", &account.Home{}, "GET:Show"), beego.NSNamespace("/searches/", beego.NSRouter("", &searches.List{}, "GET:Display"), beego.NSRouter("clear", &searches.List{}, "POST:Clear"), ), beego.NSNamespace("/settings", beego.NSRouter("", &settings.Settings{}, "GET:Display"), beego.NSRouter("/delete", &settings.Settings{}, "POST:DeleteAccount"), ), ) beego.AddNamespace(accountNS) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/object", beego.NSInclude( &controllers.ObjectController{}, ), ), beego.NSNamespace("/user", beego.NSInclude( &controllers.UserController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/lov", beego.NSInclude( &controllers.LovController{}, ), ), beego.NSNamespace("/invest", beego.NSInclude( &controllers.InvestContractController{}, ), ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/fault", beego.NSNamespace("/fault_data", beego.NSInclude( &controllers.FaultDataController{}, ), ), beego.NSNamespace("/down", beego.NSInclude( &controllers.DownController{}, ), ), ) beego.AddNamespace(ns) beego.Router("fault", &controllers.FaultDataController{}) }
func init() { fmt.Println("start route config") beego.Router("/", &controllers.MainController{}) //beego.Router("/post", &controllers.PostController{}) //beego.Router("/user", &controllers.UserController{}) ns := beego.NewNamespace("/v1", beego.NSCond(func(ctx *context.Context) bool { //if ctx.Input.Domain() == "api.genffy.com" { // return true //} //return false fmt.Println(ctx.Input.Domain()) return true }), // beego.NSRouter("/index", &controllers.MainController{}, "get:ShowAPIVersion"), // beego.NSBefore(auth), beego.NSNamespace("/post", beego.NSInclude( // 对应的注解路由 &controllers.PostController{}, ), ), beego.NSNamespace("/auth", beego.NSInclude( &controllers.UserController{}, ), ), beego.NSNamespace("/comment", beego.NSInclude( &controllers.CommentController{}, ), ), beego.NSNamespace("/meta", beego.NSInclude( &controllers.MetaController{}, ), ), // 测试超时 // beego.NSNamespace("test", // beego.NSInclude( // &controllers.TestController{}, // ), // ), ) beego.AddNamespace(ns) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/departments", beego.NSInclude( &controllers.DepartmentsController{}, ), ), beego.NSNamespace("/employees", beego.NSInclude( &controllers.EmployeesController{}, ), ), ) beego.AddNamespace(ns) }
func init() { // beego.InsertFilter("/*", beego.BeforeRouter, checkFilter) ns := beego.NewNamespace("/v1", beego.NSNamespace("/dev", beego.NSInclude( &controllers.DevController{}, ), // beego.NSRouter("/register", &controllers.RegisterController{}), ), beego.NSNamespace("/user", beego.NSBefore(check), beego.NSInclude( &controllers.UserController{}, ), ), beego.NSNamespace("/character", beego.NSBefore(check), beego.NSInclude( &controllers.CharacterController{}, ), ), beego.NSNamespace("/movie", beego.NSBefore(check), beego.NSInclude( &controllers.MovieController{}, ), ), beego.NSNamespace("/music", beego.NSBefore(check), beego.NSInclude( &controllers.MusicController{}, ), ), ) //管理员权限 admin_ns := beego.NewNamespace("/admin", beego.NSBefore(auth), beego.NSInclude( &admin.AdminController{}, ), ) beego.AddNamespace(ns, admin_ns) }
func init() { //初始化namespace //后台 adminNs := beego.NewNamespace("/admin", beego.NSAutoRouter(&admin.ArticleController{}), ) //api apiNs := beego.NewNamespace("/api", beego.NSRouter("/weather", &api.WeatherController{}, "get:Weather"), ) //注册namespace beego.AddNamespace(adminNs, apiNs) }
func init() { ns := beego.NewNamespace("/v1", beego.NSNamespace("/users", beego.NSInclude( &controllers.UsersController{}, ), ), beego.NSNamespace("/tokens", beego.NSInclude( &controllers.TokensController{}, ), ), beego.NSNamespace("/verifications", beego.NSInclude( &controllers.VerificationsController{}, ), ), ) beego.AddNamespace(ns) }