// Handle GET requests func (cr *OtterAPIController) Read(id string, cx *goweb.Context) { var otter Otter // TODO rewrite using a tohva stored in the session var err error = nil //_, err := cr.Db.Retrieve(id, &otter) if err != nil { cx.RespondWithData(otter) } else { cx.RespondWithNotFound() } }
func (cr *TeamAPIController) Read(id string, cx *goweb.Context) { if id == "1" { cx.RespondWithData(TestEntity{id, "Mat", 28}) } else if id == "2" { cx.RespondWithData(TestEntity{id, "Laurie", 27}) } else { cx.RespondWithNotFound() } }
// Handle DELETE requests func (cr *OtterAPIController) Delete(id string, cx *goweb.Context) { //var otter Otter // TODO rewrite using a tohva stored in the session // currentRev, err := cr.Db.Retrieve(id, &otter) var err error = nil if err != nil { // cr.Db.Delete(id, currentRev) cx.RespondWithOK() } else { cx.RespondWithNotFound() } }