Esempio n. 1
0
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)
}
Esempio n. 2
0
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)
}
Esempio n. 3
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/patient",
			beego.NSRouter("/:id", &controllers.PatientController{}, "get:Get"),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 4
0
File: main.go Progetto: shaalx/news
func main() {
	ns := beego.NewNamespace("/js",
		beego.NSInclude(&controllers.NewsController{}),
	)
	beego.AddNamespace(ns)
	app := beego.Include(&controllers.NewsVController{})
	app.Run()
}
Esempio n. 5
0
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()
}
Esempio n. 6
0
// Get returns the namespace for public education
func Get() *beego.Namespace {
	ns := beego.NewNamespace("education",
		beego.NSRouter("", &education.Home{}, "*:Display"),
		beego.NSNamespace("subjects/:subject",
			beego.NSRouter("", &subject.Subject{}, "GET:Display"),
		),
	)
	return ns
}
Esempio n. 7
0
File: router.go Progetto: jf/gwp
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/post",
			beego.NSInclude(
				&controllers.PostController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 8
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/crawl",
			beego.NSInclude(
				&controllers.ObjectController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 9
0
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)
}
Esempio n. 10
0
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)
}
Esempio n. 11
0
func init() {
	ns := beego.NewNamespace("/v1",

		beego.NSNamespace("/app",
			beego.NSInclude(
				&controllers.AppController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 12
0
// Get returns the Namespace for the repositories
func Get() *beego.Namespace {
	ns := beego.NewNamespace("/repositories/",
		beego.NSNamespace(":repository",
			beego.NSRouter("", &repository.Repository{}, "GET:Display"),
			beego.NSNamespace("/resources",
				beego.NSRouter("/:resource", &repository.Repository{}, "GET:DisplayResource"),
			),
		),
	)
	return ns
}
Esempio n. 13
0
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)

}
Esempio n. 14
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/manage",
			beego.NSInclude(
				&controllers.ManageController{},
			),
		),
	)
	beego.AddNamespace(ns)

}
Esempio n. 15
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/auth",
			beego.NSInclude(
				&controllers.AuthenticationController{},
			),
		),
	)
	beego.AddNamespace(ns)

}
Esempio n. 16
0
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)
}
Esempio n. 17
0
func init() {
	beego.Router("/", &controllers.MainController{}, "get:Home")

	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/posts",
			beego.NSInclude(
				&controllers.PostController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 18
0
// 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)
}
Esempio n. 19
0
func init() {
	loginC := &controllers.LoginController{}
	login := beego.NewNamespace("/login",
		beego.NSRouter("/", loginC, "get:Login"),
		beego.NSRouter("/in", loginC, "post:DoLogin"),
		beego.NSRouter("/out", loginC, "get,post:LoginOut"),
	)
	tsC := &controllers.TSController{}
	ts := beego.NewNamespace("/ts",
		beego.NSRouter("/php", tsC, "get:PHP"),
		beego.NSRouter("/js", tsC, "get:JS"),
		beego.NSRouter("/", tsC, "get:Get"),
		beego.NSRouter("/more", tsC, "get:More"),
		beego.NSRouter("/ajax", tsC, "get:AjaxGet"),
		beego.NSRouter("/post", tsC, "get,post:Post"),
	)
	tsklC := &controllers.TSKLController{}
	tskl := beego.NewNamespace("/tskl",
		beego.NSRouter("/", tsklC, "get:Get"),
		beego.NSRouter("/ajax", tsklC, "get:AjaxGet"),
		beego.NSRouter("/post", tsklC, "get,post:Post"),
		beego.NSRouter("/getkl", tsklC, "get,post:GetKL"),
		beego.NSRouter("/postkl", tsklC, "get,post:PostKL"),
	)
	userC := &controllers.UserController{}
	user := beego.NewNamespace("/user",
		beego.NSRouter("/", userC, "get:Show"),
		beego.NSRouter("/create", userC, "post:Create"),
		beego.NSRouter("/update", userC, "post:Update"),
		beego.NSRouter("/delete", userC, "post:Delete"),
	)
	sqC := &controllers.SQController{}
	sq := beego.NewNamespace("/sq",
		beego.NSRouter("/", sqC, "get:Show"),
		beego.NSRouter("/post", sqC, "post:Create"),
		beego.NSRouter("/admin", sqC, "get:AdminShow"),
		beego.NSRouter("/status", sqC, "post:AdminStatus"),
	)
	beego.AddNamespace(login, user, ts, tskl, sq)
}
Esempio n. 20
0
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)
}
Esempio n. 21
0
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)
}
Esempio n. 22
0
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)
}
Esempio n. 23
0
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)

}
Esempio n. 24
0
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)
}
Esempio n. 25
0
// 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)
}
Esempio n. 26
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/object",
			beego.NSInclude(
				&controllers.ObjectController{},
			),
		),
		beego.NSNamespace("/user",
			beego.NSInclude(
				&controllers.UserController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 27
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/ai",
			beego.NSInclude(
				&controllers.AIController{},
			),
		),
		beego.NSNamespace("/webchat",
			beego.NSInclude(
				&controllers.WebChatController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 28
0
func getAuth() *beego.Namespace {
	ns := beego.NewNamespace("auth",
		beego.NSNamespace("/login",
			beego.NSRouter("", &public.Auth{}, "GET:ShowLoginPage"),
			beego.NSRouter("", &public.Auth{}, "POST:LoginAccount"),
		),
		beego.NSNamespace("/register",
			beego.NSRouter("", &public.Auth{}, "GET:ShowRegisterForm"),
			beego.NSRouter("", &public.Auth{}, "POST:CreateNewAccount"),
		),
		beego.NSNamespace("/logout",
			beego.NSRouter("", &public.Auth{}, "POST:Logout"),
		),
	)
	return ns
}
Esempio n. 29
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/lov",
			beego.NSInclude(
				&controllers.LovController{},
			),
		),
		beego.NSNamespace("/invest",
			beego.NSInclude(
				&controllers.InvestContractController{},
			),
		),
	)
	beego.AddNamespace(ns)

}
Esempio n. 30
0
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{})
}