コード例 #1
0
ファイル: server.go プロジェクト: ZachOrr/dropzor
func listDrops(db *database.Database, r render.Render) {
	// when there's none it returns a null?
	drops, err := json.Marshal(db.ListDrops())
	fmt.Println(drops)
	if err != nil {
		r.JSON(500, map[string]interface{}{"error": err})
	} else {
		r.JSON(200, map[string]interface{}{"drops": string(drops)})
	}
}