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

Golang beego.AddNamespace函数代码示例

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

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



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

示例1: loadNS

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


示例4: 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


示例5: 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


示例6: 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


示例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() {
	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


示例9: init

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


示例10: init

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

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


示例11: init

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

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


示例12: 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


示例13: init

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

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


示例14: 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


示例15: 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


示例16: ConfigRoutes

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


示例17: 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


示例18: init

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


示例19: init

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)

}
开发者ID:yubo,项目名称:falcon,代码行数:14,代码来源:router.go


示例20: init

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang beego.AutoRouter函数代码示例发布时间:2022-05-24
下一篇:
Golang beego.AddFuncMap函数代码示例发布时间: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