mirror of
https://github.com/astaxie/beego.git
synced 2024-11-05 01:40:55 +00:00
Merge pull request #174 from Xelom/FixBra
Changed ObejctController to ObjectController in beeapi
This commit is contained in:
commit
b96f7e2ef2
@ -6,11 +6,11 @@ import (
|
|||||||
"github.com/astaxie/beego/example/beeapi/models"
|
"github.com/astaxie/beego/example/beeapi/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ObejctController struct {
|
type ObjectController struct {
|
||||||
beego.Controller
|
beego.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ObejctController) Post() {
|
func (this *ObjectController) Post() {
|
||||||
var ob models.Object
|
var ob models.Object
|
||||||
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
||||||
objectid := models.AddOne(ob)
|
objectid := models.AddOne(ob)
|
||||||
@ -18,7 +18,7 @@ func (this *ObejctController) Post() {
|
|||||||
this.ServeJson()
|
this.ServeJson()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ObejctController) Get() {
|
func (this *ObjectController) Get() {
|
||||||
objectId := this.Ctx.Params[":objectId"]
|
objectId := this.Ctx.Params[":objectId"]
|
||||||
if objectId != "" {
|
if objectId != "" {
|
||||||
ob, err := models.GetOne(objectId)
|
ob, err := models.GetOne(objectId)
|
||||||
@ -34,7 +34,7 @@ func (this *ObejctController) Get() {
|
|||||||
this.ServeJson()
|
this.ServeJson()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ObejctController) Put() {
|
func (this *ObjectController) Put() {
|
||||||
objectId := this.Ctx.Params[":objectId"]
|
objectId := this.Ctx.Params[":objectId"]
|
||||||
var ob models.Object
|
var ob models.Object
|
||||||
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
||||||
@ -48,7 +48,7 @@ func (this *ObejctController) Put() {
|
|||||||
this.ServeJson()
|
this.ServeJson()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ObejctController) Delete() {
|
func (this *ObjectController) Delete() {
|
||||||
objectId := this.Ctx.Params[":objectId"]
|
objectId := this.Ctx.Params[":objectId"]
|
||||||
models.Delete(objectId)
|
models.Delete(objectId)
|
||||||
this.Data["json"] = "delete success!"
|
this.Data["json"] = "delete success!"
|
||||||
|
@ -15,6 +15,6 @@ import (
|
|||||||
// /object/<objectId> DELETE Deleting Objects
|
// /object/<objectId> DELETE Deleting Objects
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
beego.RESTRouter("/object", &controllers.ObejctController{})
|
beego.RESTRouter("/object", &controllers.ObjectController{})
|
||||||
beego.Run()
|
beego.Run()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user