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

1091 Commits

Author SHA1 Message Date
astaxie
f6ce2656db 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-16 23:47:29 +08:00
slene
b647026dff orm: add test for unexported struct field 2014-05-16 13:14:15 +08:00
slene
568c0c47f0 Merge pull request #542 from kylemcc/develop
orm: allow unexported fields on model structs
2014-05-16 13:11:55 +08:00
astaxie
2629de28f2 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-16 10:18:19 +08:00
astaxie
10d2c7c328 config: fix the import issue 2014-05-16 10:18:19 +08:00
astaxie
af7ac98bd6 Merge pull request #609 from JessonChan/develop
[important] bug fixed
2014-05-15 11:47:07 +08:00
jessonchan
6f78f1d4b2 bug fixed 2014-05-15 11:34:44 +08:00
astaxie
9f95fd3309 Merge pull request #608 from JessonChan/develop
refactor func
2014-05-14 20:47:01 +08:00
jessonchan
74c309cefd refator func 2014-05-14 20:08:51 +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
29e113a48a Merge pull request #597 from tobyzxj/develop
httplib support to set the protocol version for incoming requests
2014-05-09 16:25:33 +08:00
toby.zxj
3caf1896d6 httplib support to set the protocol version for incoming requests 2014-05-09 15:48:50 +08:00
astaxie
d5d5f23756 httplib:support file upload 2014-05-08 16:58:08 +08:00
astaxie
46641ef3b6 fix the typo 2014-05-08 10:51:29 +08: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
b2a69f505c beego: support other analisys & fix typo 2014-04-28 18:07:30 +08:00
astaxie
e307bd7ba9 beego:hotfix for multipart/form-data 2014-04-15 05:05:53 +08:00
astaxie
b2bd829d39 beego: add link in the admin console 2014-04-15 05:03:20 +08:00
astaxie
f9b8617fa3 context: fix multipart/form-data 2014-04-15 05:02:50 +08:00
astaxie
6c6e4ecfbc update all files License 2014-04-12 13:18:18 +08:00
astaxie
8bcf03c652 fix #576 2014-04-11 16:08:43 +08:00
astaxie
1ea449aa3a beego:add post test case 2014-04-10 22:33:32 +08:00
astaxie
a99802b7d1 beego:query data from Form & params 2014-04-10 22:21:08 +08:00
astaxie
b212ec8dab beego:query data from Form & params 2014-04-10 22:20:46 +08:00
astaxie
3e16feb1e2 beego: fix flash errors 2014-04-10 18:16:08 +08:00
astaxie
e50cbecf80 beego: fix flash errors 2014-04-10 18:14:18 +08:00
astaxie
127b85bcaa 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-04-10 00:31:16 +08:00
astaxie
89dde6cd9d Merge branch 'develop' of https://github.com/astaxie/beego into develop 2014-04-09 21:43:32 +08:00
astaxie
5a52949761 beego: support not-empty value in router fix #555 2014-04-09 21:42:57 +08:00
astaxie
a78162e9e4 Merge pull request #573 from linluxiang/master
Make the Maxage Config of cookie session work
2014-04-09 14:42:29 +08:00
astaxie
931e6162ac Merge pull request #574 from dz1984/fix/cache_test
Fix/cache test
2014-04-09 14:42:01 +08:00
Lin Luxiang
1bb876f2df make Maxage work 2014-04-09 13:18:44 +08:00
Donald Zhan
18f70e6ee4 update the error message 2014-04-09 12:39:12 +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