コード例 #1
0
ファイル: handlers.go プロジェクト: beer-root/toris
// 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()
	}
}
コード例 #2
0
ファイル: team.go プロジェクト: robxu9/reservoir
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()
	}

}
コード例 #3
0
ファイル: handlers.go プロジェクト: beer-root/toris
// 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()
	}
}