• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang beego.NewNamespace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/astaxie/beego.NewNamespace函数的典型用法代码示例。如果您正苦于以下问题:Golang NewNamespace函数的具体用法?Golang NewNamespace怎么用?Golang NewNamespace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewNamespace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: init

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)
}
开发者ID:thuongdinh,项目名称:beeblog,代码行数:28,代码来源:router.go


示例2: init

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)
}
开发者ID:soyking,项目名称:MomentAPI,代码行数:30,代码来源:router.go


示例3: init

func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/patient",
			beego.NSRouter("/:id", &controllers.PatientController{}, "get:Get"),
		),
	)
	beego.AddNamespace(ns)
}
开发者ID:nodar-chkuaselidze,项目名称:bee-api-test,代码行数:8,代码来源:router.go


示例4: main

func main() {
	ns := beego.NewNamespace("/js",
		beego.NSInclude(&controllers.NewsController{}),
	)
	beego.AddNamespace(ns)
	app := beego.Include(&controllers.NewsVController{})
	app.Run()
}
开发者ID:shaalx,项目名称:news,代码行数:8,代码来源:main.go


示例5: init

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()
}
开发者ID:snicks1,项目名称:learn,代码行数:45,代码来源:router.go


示例6: Get

// 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
}
开发者ID:cristian-sima,项目名称:Wisply,代码行数:10,代码来源:education.go


示例7: init

func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/post",
			beego.NSInclude(
				&controllers.PostController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
开发者ID:jf,项目名称:gwp,代码行数:10,代码来源:router.go


示例8: init

func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/crawl",
			beego.NSInclude(
				&controllers.ObjectController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
开发者ID:coseyo,项目名称:getsale,代码行数:10,代码来源:router.go


示例9: init

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)
}
开发者ID:RT7oney,项目名称:MeNA-api-go,代码行数:43,代码来源:router.go


示例10: init

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)
}
开发者ID:Vin-Yang,项目名称:inote,代码行数:43,代码来源:router.go


示例11: init

func init() {
	ns := beego.NewNamespace("/v1",

		beego.NSNamespace("/app",
			beego.NSInclude(
				&controllers.AppController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
开发者ID:sshitaime,项目名称:go-study,代码行数:11,代码来源:router.go


示例12: Get

// 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
}
开发者ID:cristian-sima,项目名称:Wisply,代码行数:12,代码来源:repository.go


示例13: init

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)

}
开发者ID:xiaowa183,项目名称:lily,代码行数:20,代码来源:router.go


示例14: init

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

}
开发者ID:thanpogi,项目名称:beegotest,代码行数:11,代码来源:router.go


示例15: init

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

}
开发者ID:thanpogi,项目名称:beegotest,代码行数:11,代码来源:router.go


示例16: init

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)
}
开发者ID:langziguilai,项目名称:HSNet,代码行数:54,代码来源:router.go


示例17: init

func init() {
	beego.Router("/", &controllers.MainController{}, "get:Home")

	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/posts",
			beego.NSInclude(
				&controllers.PostController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
开发者ID:iamxy,项目名称:beego_react,代码行数:12,代码来源:router.go


示例18: Load

// 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)
}
开发者ID:cristian-sima,项目名称:Wisply,代码行数:13,代码来源:main.go


示例19: init

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)
}
开发者ID:tangseng,项目名称:yts,代码行数:40,代码来源:router.go


示例20: ConfigRoutes

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)
}
开发者ID:Cepave,项目名称:fe,代码行数:22,代码来源:dashboard_routes.go



注:本文中的github.com/astaxie/beego.NewNamespace函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang beego.ReadFromRequest函数代码示例发布时间:2022-05-24
下一篇:
Golang beego.NewFlash函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap