Esempio n. 1
0
func CreateUser(w http.ResponseWriter, r *http.Request) {
	u := &model.User{}

	json.NewDecoder(r.Body).Decode(u)

	model.InsertUser(u)

	w.WriteHeader(201)
	json.NewEncoder(w).Encode(map[string]interface{}{"id": u.Id()})
}
Esempio n. 2
0
func post_users(c *golax.Context) {
	u := &model.User{}

	json.NewDecoder(c.Request.Body).Decode(u)

	model.InsertUser(u)

	c.Response.WriteHeader(201)
	json.NewEncoder(c.Response).Encode(map[string]interface{}{"id": u.Id()})
}