1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-10 20:40:55 +00:00
Commit Graph

3 Commits

Author SHA1 Message Date
astaxie
5dee6b7d19 beego: fix the namespace cond 2014-05-28 10:23:31 +08:00
astaxie
0d17d974cd beego: update namespace 2014-05-23 15:56:25 +08:00
astaxie
e657dcfd5f 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")))
	}),
)
2014-05-17 02:26:51 +08:00