• astaxie's avatar
    beego: support namespace · e657dcfd
    astaxie authored
    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")))
    	}),
    )
    e657dcfd
namespace_test.go 3.57 KB