Documentation ¶
Overview ¶
* Create and get notes
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Authenticate = func(w http.ResponseWriter, r *http.Request) { account := &models.Account{} err := json.NewDecoder(r.Body).Decode(account) if err != nil { u.Respond(w, u.Message(false, "Invalid request")) return } resp := models.Login(account.Email, account.Password) u.Respond(w, resp) }
View Source
var CreateAccount = func(w http.ResponseWriter, r *http.Request) { account := &models.Account{} err := json.NewDecoder(r.Body).Decode(account) if err != nil { u.Respond(w, u.Message(false, "Invalid request")) return } resp := account.Create() u.Respond(w, resp) }
View Source
var CreateNote = func(w http.ResponseWriter, r *http.Request) { user := r.Context().Value("user").(uint) note := &models.Note{} err := json.NewDecoder(r.Body).Decode(note) if err != nil { u.Respond(w, u.Message(false, "Error while decoding request body")) return } note.UserId = user resp := note.Create() u.Respond(w, resp) }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.