Documentation ¶
Index ¶
- func Authenticate(body []byte, dbx *sqlx.DB) (model.User, error)
- func CORSMiddleware() func(*web.C, http.Handler) http.Handler
- func ReadWholeBody(httpReq *http.Request) ([]byte, error)
- func RenderJSON(w http.ResponseWriter, data interface{})
- func ReportError(w http.ResponseWriter, err error) bool
- func ReportOK(w http.ResponseWriter)
- func Wrap(dbx *sqlx.DB, ...) func(web.C, http.ResponseWriter, *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate confirms that the request is created by a registered user and identifies her/him.
func CORSMiddleware ¶
CORSMiddleware is a Goji middleware adding headers about Cross-Origin Resource Sharing.
func ReadWholeBody ¶
ReadWholeBody stores the entire request body into a byte array.
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, data interface{})
RenderJSON stringifies `data` as JSON and writes it to the response.
func ReportError ¶
func ReportError(w http.ResponseWriter, err error) bool
ReportError writes an JSON string containing the error message to the response.
func ReportOK ¶
func ReportOK(w http.ResponseWriter)
ReportOK writes an nullary successful JSON string to the response.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.