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 |
|
astaxie
|
55ad951bce
|
beego: support more router
//design model
beego.Get(router, beego.FilterFunc)
beego.Post(router, beego.FilterFunc)
beego.Put(router, beego.FilterFunc)
beego.Head(router, beego.FilterFunc)
beego.Options(router, beego.FilterFunc)
beego.Delete(router, beego.FilterFunc)
beego.Handler(router, http.Handler)
//example
beego.Get("/user", func(ctx *context.Context) {
ctx.Output.Body([]byte("Get userlist"))
})
beego.Post("/user", func(ctx *context.Context) {
ctx.Output.Body([]byte("add userlist"))
})
beego.Delete("/user/:id", func(ctx *context.Context) {
ctx.Output.Body([]byte([]byte(ctx.Input.Param(":id")))
})
import (
"http"
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
)
func init() {
s := rpc.NewServer()
s.RegisterCodec(json.NewCodec(), "application/json")
s.RegisterService(new(HelloService), "")
beego.Handler("/rpc", s)
}
|
2014-05-17 02:26:51 +08:00 |
|
astaxie
|
c188cbbcb4
|
update all files License
|
2014-05-17 02:26:50 +08:00 |
|
Francois
|
bc2f1fb79d
|
Update app.go
|
2014-05-13 17:19:50 +02:00 |
|
astaxie
|
d57557dc55
|
add AutoRouterWithPrefix
|
2014-01-01 17:57:57 +08:00 |
|
傅小黑
|
ff18ae2562
|
add api comments in file memzipfile.go,reload.go,router.go,template.go and templatefunc.go, fix spelling error GetInitListner as GetInitListener.
|
2013-12-21 13:19:24 +08:00 |
|
傅小黑
|
ce332713c4
|
gofmt commented go files
|
2013-12-20 22:35:16 +08:00 |
|
傅小黑
|
933e98e4f2
|
add api comments in file beego.go
|
2013-12-20 19:36:54 +08:00 |
|
傅小黑
|
3f3bf299a6
|
add api comments in file app.go
|
2013-12-20 19:20:13 +08:00 |
|
vadimi
|
12a37f71be
|
Fixed some typos
|
2013-12-04 22:27:29 -05:00 |
|
astaxie
|
3c91360d72
|
dictinct system pkg and third pkg
|
2013-12-03 21:37:39 +08:00 |
|
Pengfei Xue
|
e823b6ea95
|
add server host:port info when starting app
|
2013-11-26 15:30:59 +08:00 |
|
knightmare
|
47fc32ba47
|
add func InsertFilter(pattern string, pos int, filter FilterFunc) *App to replace AddFilter
pos can be const:
BeforeRouter = iota
AfterStatic
BeforeExec
AfterExec
FinishRouter
|
2013-11-25 15:59:40 +08:00 |
|
astaxie
|
a981dab536
|
fix #286
the process exit and the channel info can't flush to console
|
2013-11-13 21:11:08 +08:00 |
|
astaxie
|
9446563e5b
|
add util func to get the url fix #282
UrlFor(endpoint string, values ...string) string
|
2013-11-10 23:05:07 +08:00 |
|
astaxie
|
63da329468
|
go on modify api
|
2013-09-10 00:17:49 +08:00 |
|
astaxie
|
bd61dd9ffc
|
change a log about new version
|
2013-09-10 00:00:18 +08:00 |
|