-
astaxie authored
//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) }
55ad951b