示例#1
0
func UpdateItemHandler(params martini.Params, item types.Item, r render.Render, db *mgo.Database) {
	DB.Update(params["id"], item, db)
	r.JSON(200, DB.GetAll(db))
}
示例#2
0
func PostItemHandler(item types.Item, r render.Render, db *mgo.Database) {
	DB.AddNew(item, db)
	r.JSON(200, DB.GetAll(db))
}
示例#3
0
func DeleteItemHandler(params martini.Params, r render.Render, db *mgo.Database) {
	DB.Remove(params["id"], db)
	r.JSON(200, DB.GetAll(db))
}
示例#4
0
func GetItemsHandler(r render.Render, db *mgo.Database) {
	r.JSON(200, DB.GetAll(db))
}