This commit is contained in:
Sergey Melnikov 2024-01-17 11:52:59 +03:00
parent 0a4a2f9df9
commit 9856d04a20

View File

@ -94,12 +94,13 @@ func (a *API) getUser() http.HandlerFunc {
// @Failure default {object} structs.ANSWERAPI // @Failure default {object} structs.ANSWERAPI
// @Router /user [post] // @Router /user [post]
// writeUser gets json request and write to nosql, without id - create new user // writeUser gets json request and write to nosql, without id - create new user
// { //
// "firstname":"username", // {
// "lastname":"username", // "firstname":"username",
// "birthday":"1972-06-10", // "lastname":"username",
// "currentlocation":"Location" // "birthday":"1972-06-10",
// } // "currentlocation":"Location"
// }
func (a *API) createUser() http.HandlerFunc { func (a *API) createUser() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var user *structs.USER var user *structs.USER
@ -251,5 +252,8 @@ func (a *API) respond(w http.ResponseWriter, r *http.Request, code int, data int
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
return return
} }
_ = json.NewEncoder(w).Encode(setAnswer(data, e, add)) err := json.NewEncoder(w).Encode(setAnswer(data, e, add))
if err != nil {
return
}
} }