Example #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)
}
Example #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)
}
Example #3
0
// Get returns the Namespace for data
func Get() func(*beego.Namespace) {
	ns := beego.NSNamespace("/data/",
		beego.NSNamespace("/table",
			beego.NSRouter("", &data.Table{}, "GET:ShowList"),
			beego.NSRouter("generate/:name", &data.Table{}, "*:Generate"),
			beego.NSRouter("download/:name", &data.Table{}, "*:Download"),
		),
	)
	return ns
}
Example #4
0
func getRepository() func(*beego.Namespace) {
	ns := beego.NSNamespace("/repository",
		beego.NSNamespace("/resources/:id",
			beego.NSNamespace("/get",
				beego.NSRouter("/:min/:number", &api.Repository{}, "GET:GetResources"),
			),
		),
	)
	return ns
}
Example #5
0
// Get returns the namespace for institutions
func Get() func(*beego.Namespace) {

	ns := beego.NSNamespace("/repositories",
		beego.NSRouter("", &repositories.Home{}, "*:Display"),
		beego.NSNamespace("/add",
			beego.NSRouter("", &repository.Repository{}, "GET:ShowChooseCategory"),
		),
		beego.NSNamespace("/newRepository",
			beego.NSRouter("", &repository.Repository{}, "GET:ShowInsertForm"),
			beego.NSRouter("", &repository.Repository{}, "POST:Insert"),
		),
		beego.NSNamespace("/:repository",
			beego.NSRouter("", &repository.Repository{}, "GET:Display"),
			beego.NSNamespace("/advance-options",
				beego.NSRouter("", &repository.Repository{}, "GET:ShowAdvanceOptions"),
				beego.NSNamespace("/modify",
					beego.NSRouter("", &repository.Repository{}, "GET:ShowModifyForm"),
					beego.NSRouter("", &repository.Repository{}, "POST:Modify"),
					beego.NSNamespace("/filter",
						beego.NSRouter("", &repository.Repository{}, "GET:ShowFilterForm"),
						beego.NSRouter("", &repository.Repository{}, "POST:ModifyFilter"),
					),
				),
			),
			beego.NSNamespace("/clear",
				beego.NSRouter("", &repository.Repository{}, "POST:ClearRepository"),
			),
			beego.NSNamespace("/delete",
				beego.NSRouter("", &repository.Repository{}, "POST:Delete"),
			),
		),
	)
	return ns
}
Example #6
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
}
Example #7
0
// Get returns the namespace for api
func getSearch() func(*beego.Namespace) {
	ns := beego.NSNamespace("/search",
		beego.NSNamespace("/anything/:query",
			beego.NSRouter("", &api.Search{}, "*:SearchAnything"),
		),
		beego.NSNamespace("/save/:query",
			beego.NSRouter("", &api.Search{}, "POST:JustSaveAccountQuery"),
		),
	)
	return ns
}
Example #8
0
// Get returns the Namespace for data
func Get() func(*beego.Namespace) {
	ns := beego.NSNamespace("/tools",
		beego.NSNamespace("/digester",
			beego.NSRouter("", &tools.Digester{}, "GET:Display"),
			beego.NSRouter("", &tools.Digester{}, "POST:Work"),
		),
		beego.NSNamespace("/web-digester",
			beego.NSRouter("", &tools.WebDigester{}, "GET:Display"),
			beego.NSRouter("", &tools.WebDigester{}, "POST:Work"),
		),
	)
	return ns
}
Example #9
0
// Get returns the Namespace for the accounts within administration area
func Get() func(*beego.Namespace) {
	ns := beego.NSNamespace("/accounts",
		beego.NSRouter("", &accountsController.Home{}, "*:Display"),
		beego.NSNamespace("/:account",
			beego.NSNamespace("/modify",
				beego.NSRouter("", &accountController.Account{}, "GET:ShowModifyForm"),
				beego.NSRouter("", &accountController.Account{}, "POST:Modify"),
			),
			beego.NSRouter("/delete", &accountController.Account{}, "POST:Delete"),
		),
	)
	return ns
}
Example #10
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)

}
Example #11
0
func getHarvest() func(*beego.Namespace) {
	ns := beego.NSNamespace("/harvest",
		beego.NSNamespace("/process/:process",
			beego.NSRouter("", &process.Process{}, "*:Display"),
			beego.NSNamespace("/operation/:operation",
				beego.NSRouter("", &process.Operation{}, "*:Display"),
			),
			beego.NSRouter("/history", &process.Process{}, "*:ShowHistory"),
			beego.NSRouter("/advance-options", &process.Process{}, "*:ShowAdvanceOptions"),
			beego.NSRouter("/delete", &process.Process{}, "POST:Delete"),
		),
	)
	return ns
}
Example #12
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/ai",
			beego.NSInclude(
				&controllers.AIController{},
			),
		),
		beego.NSNamespace("/webchat",
			beego.NSInclude(
				&controllers.WebChatController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Example #13
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/object",
			beego.NSInclude(
				&controllers.ObjectController{},
			),
		),
		beego.NSNamespace("/user",
			beego.NSInclude(
				&controllers.UserController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Example #14
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)
}
Example #15
0
func getHarvest() func(*beego.Namespace) {
	ns := beego.NSNamespace("/harvest",
		beego.NSNamespace("/init",
			beego.NSRouter(":id", &admin.Harvest{}, "POST:ShowPanel"),
			beego.NSRouter("/ws", &admin.Harvest{}, "GET:InitWebsocketConnection"),
		),
		beego.NSNamespace("/recover",
			beego.NSRouter(":id", &admin.Harvest{}, "POST:RecoverProcess"),
		),
		beego.NSNamespace("/finish",
			beego.NSRouter(":id", &admin.Harvest{}, "POST:ForceFinishProcess"),
		),
	)
	return ns
}
Example #16
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)
}
Example #17
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
}
Example #18
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{})
}
Example #19
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/lov",
			beego.NSInclude(
				&controllers.LovController{},
			),
		),
		beego.NSNamespace("/invest",
			beego.NSInclude(
				&controllers.InvestContractController{},
			),
		),
	)
	beego.AddNamespace(ns)

}
Example #20
0
// Get returns the Namespace for API
func Get() func(*beego.Namespace) {
	ns := beego.NSNamespace("/api",
		getRepository(),
		getSearch(),
	)
	return ns
}
Example #21
0
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)
}
Example #23
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/patient",
			beego.NSRouter("/:id", &controllers.PatientController{}, "get:Get"),
		),
	)
	beego.AddNamespace(ns)
}
Example #24
0
// Get returns the namespace for log
func Get() func(*beego.Namespace) {
	ns := beego.NSNamespace("/log",
		beego.NSRouter("", &log.Home{}, "*:Display"),
		getHarvest(),
		beego.NSRouter("/advance-options", &log.Home{}, "*:DisplayAdvanceOptions"),
		beego.NSRouter("/delete", &log.Home{}, "POST:Delete"),
	)
	return ns
}
Example #25
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
}
Example #26
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)
}
Example #27
0
File: router.go Project: jf/gwp
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/post",
			beego.NSInclude(
				&controllers.PostController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Example #28
0
// Get returns the routers for the education
func Get() func(*beego.Namespace) {
	subject := getSubject()
	ns := beego.NSNamespace("/education",
		beego.NSRouter("/analyse", &education.Home{}, "GET:Analyse"),
		beego.NSRouter("/analyser/:analyser/delete", &education.Home{}, "POST:DeleteAnalyser"),
		beego.NSRouter("", &education.Home{}, "*:Display"),
		subject,
	)
	return ns
}
Example #29
0
func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/crawl",
			beego.NSInclude(
				&controllers.ObjectController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Example #30
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)
}