- 23 May, 2014 1 commit
-
-
astaxie authored
-
- 20 May, 2014 9 commits
-
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
config := tls.Config{ ClientAuth: tls.RequireAndVerifyClientCert, Certificates: []tls.Certificate{cert}, ClientCAs: pool, } config.Rand = rand.Reader beego.BeeApp.Server. TLSConfig = &config
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
- 19 May, 2014 1 commit
-
-
astaxie authored
-
- 16 May, 2014 29 commits
-
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
ServeFormatted serve Xml OR Json, depending on the value of the Accept header
-
astaxie authored
-
astaxie authored
gob.Register(v)
-
astaxie authored
default value is true when you Enable Global XSRF, also can control in the prepare function to change the value.
-
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"))) }), )
-
slene authored
-
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) }
-
astaxie authored
-
jessonchan authored
-
jessonchan authored
-
toby.zxj authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
-
astaxie authored
// Bind data from request.Form[key] to dest // like /?id=123&isok=true&ft=1.2&ol[0]=1&ol[1]=2&ul[]=str&ul[]=array&user.Name= astaxie // var id int beegoInput.Bind(&id, "id") id ==123 // var isok bool beegoInput.Bind(&isok, "isok") id ==true // var ft float64 beegoInput.Bind(&ft, "ft") ft ==1.2 // ol := make([]int, 0, 2) beegoInput.Bind(&ol, "ol") ol ==[1 2] // ul := make([]string, 0, 2) beegoInput.Bind(&ul, "ul") ul ==[str array] // user struct{Name} beegoInput.Bind(&user, "user") user == {Name:"astaxie"}
-
astaxie authored
-
Lin Luxiang authored
-
Donald Zhan authored
-
Kyle McCullough authored
-
astaxie authored
-
astaxie authored
ServeFormatted serve Xml OR Json, depending on the value of the Accept header
-