Merge pull request #174 from Xelom/FixBra
Changed ObejctController to ObjectController in beeapi
Showing
2 changed files
with
6 additions
and
6 deletions
| ... | @@ -6,11 +6,11 @@ import ( | ... | @@ -6,11 +6,11 @@ import ( |
| 6 | "github.com/astaxie/beego/example/beeapi/models" | 6 | "github.com/astaxie/beego/example/beeapi/models" |
| 7 | ) | 7 | ) |
| 8 | 8 | ||
| 9 | type ObejctController struct { | 9 | type ObjectController struct { |
| 10 | beego.Controller | 10 | beego.Controller |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | func (this *ObejctController) Post() { | 13 | func (this *ObjectController) Post() { |
| 14 | var ob models.Object | 14 | var ob models.Object |
| 15 | json.Unmarshal(this.Ctx.RequestBody, &ob) | 15 | json.Unmarshal(this.Ctx.RequestBody, &ob) |
| 16 | objectid := models.AddOne(ob) | 16 | objectid := models.AddOne(ob) |
| ... | @@ -18,7 +18,7 @@ func (this *ObejctController) Post() { | ... | @@ -18,7 +18,7 @@ func (this *ObejctController) Post() { |
| 18 | this.ServeJson() | 18 | this.ServeJson() |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | func (this *ObejctController) Get() { | 21 | func (this *ObjectController) Get() { |
| 22 | objectId := this.Ctx.Params[":objectId"] | 22 | objectId := this.Ctx.Params[":objectId"] |
| 23 | if objectId != "" { | 23 | if objectId != "" { |
| 24 | ob, err := models.GetOne(objectId) | 24 | ob, err := models.GetOne(objectId) |
| ... | @@ -34,7 +34,7 @@ func (this *ObejctController) Get() { | ... | @@ -34,7 +34,7 @@ func (this *ObejctController) Get() { |
| 34 | this.ServeJson() | 34 | this.ServeJson() |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | func (this *ObejctController) Put() { | 37 | func (this *ObjectController) Put() { |
| 38 | objectId := this.Ctx.Params[":objectId"] | 38 | objectId := this.Ctx.Params[":objectId"] |
| 39 | var ob models.Object | 39 | var ob models.Object |
| 40 | json.Unmarshal(this.Ctx.RequestBody, &ob) | 40 | json.Unmarshal(this.Ctx.RequestBody, &ob) |
| ... | @@ -48,7 +48,7 @@ func (this *ObejctController) Put() { | ... | @@ -48,7 +48,7 @@ func (this *ObejctController) Put() { |
| 48 | this.ServeJson() | 48 | this.ServeJson() |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | func (this *ObejctController) Delete() { | 51 | func (this *ObjectController) Delete() { |
| 52 | objectId := this.Ctx.Params[":objectId"] | 52 | objectId := this.Ctx.Params[":objectId"] |
| 53 | models.Delete(objectId) | 53 | models.Delete(objectId) |
| 54 | this.Data["json"] = "delete success!" | 54 | this.Data["json"] = "delete success!" | ... | ... |
| ... | @@ -15,6 +15,6 @@ import ( | ... | @@ -15,6 +15,6 @@ import ( |
| 15 | // /object/<objectId> DELETE Deleting Objects | 15 | // /object/<objectId> DELETE Deleting Objects |
| 16 | 16 | ||
| 17 | func main() { | 17 | func main() { |
| 18 | beego.RESTRouter("/object", &controllers.ObejctController{}) | 18 | beego.RESTRouter("/object", &controllers.ObjectController{}) |
| 19 | beego.Run() | 19 | beego.Run() |
| 20 | } | 20 | } | ... | ... |
-
Please register or sign in to post a comment