Documentation ¶
Index ¶
- type ErrorResponder
- type HTTPStatusError
- type HandlerFunc
- type Page
- type Response
- type Router
- func (re *Router) FileHandler(ph string) HandlerFunc
- func (re *Router) HandlePage(title string, body interface{}) http.HandlerFunc
- func (re *Router) HandlePprof() http.HandlerFunc
- func (re *Router) HandlePprofProfile() http.HandlerFunc
- func (re *Router) RenderTemplate(data interface{}) http.HandlerFunc
- func (re *Router) Respond(data interface{}, status int) http.HandlerFunc
- func (re *Router) Response(resp *Response, statuscode int) HandlerFunc
- func (re *Router) Router() *mux.Router
- func (re *Router) WithError(h HandlerFunc) http.HandlerFunc
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponder ¶
type ErrorResponder interface {
RespondError(w http.ResponseWriter, r *http.Request, re *Router) bool
}
ErrorResponder responds with error
type HTTPStatusError ¶
type HTTPStatusError struct {
// contains filtered or unexported fields
}
HTTPStatusError http statuscode errors
func HTTPError ¶
func HTTPError(statuscode int, err error) *HTTPStatusError
HTTPError handle HTTP error
func HTTPErrorWithBody ¶
func HTTPErrorWithBody(body interface{}, statuscode int, err error) *HTTPStatusError
HTTPErrorWithBody handle HTTP error with body
func HTTPErrorWithReport ¶
func HTTPErrorWithReport(statuscode int, err error) *HTTPStatusError
HTTPErrorWithReport handle HTTP error returning status report
func (*HTTPStatusError) RespondError ¶
func (e *HTTPStatusError) RespondError(w http.ResponseWriter, r *http.Request, re *Router) bool
RespondError HTTP error response
type HandlerFunc ¶
type HandlerFunc func(w http.ResponseWriter, r *http.Request) error
HandlerFunc custom handler function that passes errors
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Response ¶
type Response struct { Title string Vars map[string]string Query url.Values Session map[interface{}]interface{} Body interface{} Status Status }
Response HTTP Response
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router Configuration
func (*Router) FileHandler ¶
func (re *Router) FileHandler(ph string) HandlerFunc
FileHandler handles loading file assets
func (*Router) HandlePage ¶
func (re *Router) HandlePage(title string, body interface{}) http.HandlerFunc
HandlePage handles page requests with body
func (*Router) HandlePprof ¶
func (re *Router) HandlePprof() http.HandlerFunc
HandlePprof pprof index
func (*Router) HandlePprofProfile ¶
func (re *Router) HandlePprofProfile() http.HandlerFunc
HandlePprofProfile pprof profile
func (*Router) RenderTemplate ¶
func (re *Router) RenderTemplate(data interface{}) http.HandlerFunc
RenderTemplate renders html templates
func (*Router) Respond ¶
func (re *Router) Respond(data interface{}, status int) http.HandlerFunc
Respond responds with data json
func (*Router) Response ¶
func (re *Router) Response(resp *Response, statuscode int) HandlerFunc
Response handles http respondes
func (*Router) WithError ¶
func (re *Router) WithError(h HandlerFunc) http.HandlerFunc
WithError error handler
Click to show internal directories.
Click to hide internal directories.