workshop/internal/controllers/accountController.go
Dmitry Sirotkin 083c02116b init
2025-03-21 19:49:54 +03:00

20 lines
431 B
Go

package controllers
import (
"gocommunity.ru/workshop/internal/models"
u "gocommunity.ru/workshop/internal/utils"
"encoding/json"
"net/http"
)
var CreateService = func(w http.ResponseWriter, r *http.Request) {
account := &models.Service{}
err := json.NewDecoder(r.Body).Decode(account)
if err != nil {
u.Respond(w, u.Message(false, "Invalid request!"))
return
}
resp := account.CreateService()
u.Respond(w, resp)
}