mirror of
https://github.com/astaxie/beego.git
synced 2025-07-04 09:40:19 +00:00
beego: support namespace
ns := beego.NewNamespace("/v1/api/") ns.Cond(func(ctx *context.Context)bool{ if ctx.Input.Domain() == "www.beego.me" { return true } return false }) .Filter("before", Authenticate) .Router("/order", &admin.OrderController{}) .Get("/version",func (ctx *context.Context) { ctx.Output.Body([]byte("1.0.0")) }) .Post("/login",func (ctx *context.Context) { if ctx.Query("username") == "admin" && ctx.Query("username") == "password" { } }) .Namespace( NewNamespace("/shop"). Get("/order/:id", func(ctx *context.Context) { ctx.Output.Body([]byte(ctx.Input.Param(":id"))) }), )
This commit is contained in:
4
beego.go
4
beego.go
@ -170,8 +170,8 @@ func Any(rootpath string, f FilterFunc) *App {
|
||||
}
|
||||
|
||||
// register router for own Handler
|
||||
func Handler(rootpath string, h http.Handler) *App {
|
||||
BeeApp.Handler(rootpath, h)
|
||||
func Handler(rootpath string, h http.Handler, options ...interface{}) *App {
|
||||
BeeApp.Handler(rootpath, h, options...)
|
||||
return BeeApp
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user