Documentation ¶
Index ¶
Constants ¶
View Source
const ( ContentType = "content-type" ContentTypeJson = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func GetMux ¶
func GetMux(actx *AppContext) http.Handler
GetMux returns a handler configured to process all required operations. Sub-handlers require server context to be configured properly.
func HandlerCapture ¶
func HandlerCapture(w http.ResponseWriter, r *http.Request, actx *AppContext) error
func HandlerGetAll ¶
func HandlerGetAll(w http.ResponseWriter, r *http.Request, actx *AppContext) error
Types ¶
type ApiError ¶
type ApiError struct {
Message string
}
ApiError is the error model for all API responses.
func (ApiError) WriteToResponse ¶
WriteToResponse write status code and error content to the response.
type AppContext ¶
AppContext stores runtime dependencies for server's handlers Not protected from changes, so just do not change it's content in handlers please. But you can copy it instead.
type AppHandler ¶
type AppHandler func(http.ResponseWriter, *http.Request, *AppContext) error
AppHandler is a http.Handler enriched with application context. In case of error it should return go error instead of using Writer.
Click to show internal directories.
Click to hide internal directories.