コード例 #1
0
// List lists all stores
func (store_c StoresController) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	store := models.Store{
		Name: "Greate Company",
		ID:   "FakeId",
	}

	storeJSON := store.ToJSON()
	store_c.renderJSON(w, storeJSON, 200)
}
コード例 #2
0
// Create - create store record
func (store_c StoresController) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	store := models.Store{}

	json.NewDecoder(r.Body).Decode(&store)

	store.ID = "FakeId"

	storeJSON := store.ToJSON()
	store_c.renderJSON(w, storeJSON, 201)
}