Documentation ¶
Index ¶
- type Handler
- type HandlerError
- type HandlerWithParams
- type Router
- func (r Router) DELETE(path string, handler HandlerWithParams)
- func (r Router) GET(path string, handler Handler)
- func (r Router) GETWithParams(path string, handler HandlerWithParams)
- func (r Router) POST(path string, handler Handler)
- func (r Router) POSTWithParams(path string, handler HandlerWithParams)
- func (r Router) PUT(path string, handler HandlerWithParams)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler func(http.ResponseWriter, *http.Request) *HandlerError
type HandlerError ¶
HandlerError is a customized error type used to improve error reporting in handlers by including additional information to be sent back to the user
func NewHandlerError ¶
func NewHandlerError(err error, message string, code int) *HandlerError
NewHandlerError initializes an HandlerError
func NewSimpleHandlerError ¶
func NewSimpleHandlerError(message string, code int) *HandlerError
NewSimpleHandlerError initializes an HandlerError by first duplicating the error message into an error type using errors.New
func NewStringHandlerError ¶
func NewStringHandlerError(err, message string, code int) *HandlerError
NewStringHandlerError initializes an HandlerError, but first converts the err string into an error type using errors.New
func (*HandlerError) Error ¶
func (e *HandlerError) Error() string
type HandlerWithParams ¶
type HandlerWithParams func(http.ResponseWriter, *http.Request, httprouter.Params) *HandlerError
type Router ¶
type Router struct { *httprouter.Router // contains filtered or unexported fields }
Router is a wrapper around julienschmidt/httprouter that implements error handling specific to this application.
func NewWithPrefix ¶
NewWithPrefix creates a Router that adds an option to use a common prefix for all the paths.
func (Router) DELETE ¶
func (r Router) DELETE(path string, handler HandlerWithParams)
func (Router) GETWithParams ¶
func (r Router) GETWithParams(path string, handler HandlerWithParams)
func (Router) POSTWithParams ¶
func (r Router) POSTWithParams(path string, handler HandlerWithParams)
func (Router) PUT ¶
func (r Router) PUT(path string, handler HandlerWithParams)