type rootHandler func(http.ResponseWriter, *http.Request) error func loginHandler(w http.ResponseWriter, r *http.Request) error { if r.Method!= http.MethodPost { return NewHTTPError(nil, 405, "Method not allowed.")
var schema loginSchema if err = json.Unmarshal(body, &schema); err!= nil { return NewHTTPError(err, 400, "Bad request : invalid JSON.")