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

981 Commits

Author SHA1 Message Date
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
slene
2ed9b2bffd orm: add test for unexported struct field 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
ef815bf5fc config: fix the import issue 2014-05-17 02:26:51 +08:00
jessonchan
6082a0af3e bug fixed 2014-05-17 02:26:51 +08:00
jessonchan
be30fb7937 refator func 2014-05-17 02:26:51 +08:00
toby.zxj
f4e7d63e65 httplib support to set the protocol version for incoming requests 2014-05-17 02:26:51 +08:00
astaxie
14688f240f httplib:support file upload 2014-05-17 02:26:51 +08:00
astaxie
dce09837b9 fix the typo 2014-05-17 02:26:50 +08:00
astaxie
3b9a404138 beego: support other analisys & fix typo 2014-05-17 02:26:50 +08:00
astaxie
a6f55b59cf beego: add link in the admin console 2014-05-17 02:26:50 +08:00
astaxie
c188cbbcb4 update all files License 2014-05-17 02:26:50 +08:00
astaxie
4245521660 fix #576 2014-05-17 02:26:50 +08:00
astaxie
05e5baaa9f beego:add post test case 2014-05-17 02:26:50 +08:00
astaxie
54b92e9599 context:add Bind function
// 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"}
2014-05-17 02:26:50 +08:00
astaxie
aa68ffecec beego: support not-empty value in router fix #555 2014-05-17 02:26:50 +08:00
Lin Luxiang
78991c81ab make Maxage work 2014-05-17 02:26:49 +08:00
Donald Zhan
348ff13857 update the error message 2014-05-17 02:26:49 +08:00
Kyle McCullough
52817fb668 allow unexported fields on model structs 2014-05-17 02:26:49 +08:00
astaxie
b6d63c84ae Merge pull request #605 from francoishill/patch-6
Update app.go
2014-05-14 13:12:15 +08:00
Francois
bc2f1fb79d Update app.go 2014-05-13 17:19:50 +02:00
astaxie
8ed459512f Merge pull request #591 from luosangnanka/master
Update Session package README.md
2014-05-05 16:43:53 +08:00
luosangnanka
25768f0109 Update README.md
Update the json format of session for file, redis, mysql, cookie, there are errors in these json string, such as after the param `ProviderConfig` and there is a lost of `"` in the line 61 of the `gclifetime`.
2014-05-05 16:21:50 +08:00
luosangnanka
a56f67e073 Update README.md
Update the json format of session for file, redis, mysql, there are errors in these json string, after `ProviderConfig` params.
2014-05-05 16:15:49 +08:00
luosangnanka
8164f9821d Update README.md
Update the json format of session for redis, there is an error in that json string
2014-05-05 16:13:03 +08:00
astaxie
e307bd7ba9 beego:hotfix for multipart/form-data 2014-04-15 05:05:53 +08:00
astaxie
a99802b7d1 beego:query data from Form & params 2014-04-10 22:21:08 +08:00
astaxie
3e16feb1e2 beego: fix flash errors 2014-04-10 18:16:08 +08:00
astaxie
82ca85dc65 release new version 1.1.4 2014-04-08 17:49:12 +08:00
astaxie
f9cc9e9eb3 beego: release new version 1.1.4 2014-04-08 17:45:57 +08:00
astaxie
18fee2ad9a beego: fixed serious Directory Traversal 2014-04-08 17:43:25 +08:00
astaxie
4124760706 beego: filter the static file's url 2014-04-07 14:20:30 +08:00
astaxie
3fe4f8c362 toolbox: modify the godocs 2014-04-06 01:05:20 +08:00
astaxie
5a863b45f4 beego: BeeAdminApp private 2014-04-06 01:02:10 +08:00
astaxie
3ad30d48b5 beego: fix the godoc 2014-04-06 00:53:18 +08:00
astaxie
3255a43568 beego: move staticServer to New file 2014-04-06 00:18:21 +08:00
astaxie
73d757e3f4 context: improve the formParse 2014-04-06 00:08:03 +08:00
astaxie
deb28dd873 fix session test case 2014-04-04 10:16:34 +08:00
astaxie
7f394feab5 beego: hot fix for TestBeegoInit can't parsefile 2014-04-04 10:04:36 +08:00
astaxie
8cbea70e07 beego: hot fix for TestBeegoInit can't parsefile 2014-04-04 10:04:22 +08:00
astaxie
f222f5b238 beego: hot fix for console logs & go run can't find file. 2014-04-04 09:57:57 +08:00
astaxie
3f1de576e4 fix go run hello.go & console log 2014-04-04 09:57:51 +08:00
slene
f48ca96a7e beego: fix log output when SetLogger has error 2014-04-04 09:57:45 +08:00
slene
9421a21037 beego: fix log output when SetLogger has error 2014-04-04 09:57:37 +08:00
astaxie
5c06cd090c beego: hot fix for console logs & go run can't find file. 2014-04-04 09:56:25 +08:00
astaxie
fc982feeb9 fix go run hello.go & console log 2014-04-04 09:49:57 +08:00
slene
31de651053 beego: fix log output when SetLogger has error 2014-04-04 09:49:57 +08:00
slene
f4d62d3193 beego: fix dependency of cache / session sub package 2014-04-04 08:31:22 +08:00
slene
acbdeb62e8 beego: fix log output when SetLogger has error 2014-04-04 08:22:26 +08:00
slene
d58e9e6e12 beego: move dependency module to sub package 2014-04-03 23:41:48 +08:00