Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { // Handle calls the current handler. Handle(w http.ResponseWriter, r *ParsedRequest, next func() Handler) Handler // HandleAll calls the current handler and all following handlers. HandleAll(w http.ResponseWriter, r *ParsedRequest) // Next returns the following handler. Next() Handler }
Handler is an interface that defines any request handler of this Framework. The handlers are used by the router to process HTTP Requests.
func NewErrorHandler ¶
NewErrorHandler creates an error handler according to the net/http default implementation
func NewHandler ¶
func NewHandler(firstHandler HandlerFunc, optionalHandlers ...HandlerFunc) Handler
NewHandler creates a HTTP handler from default implementation. It takes one or more Handler Functions that act as middleware for the handler.
func NewNativeHandler ¶
NewNativeHandler creates a handler from a net/http Handler.
type HandlerFunc ¶
type HandlerFunc func(w http.ResponseWriter, r *ParsedRequest, next func() Handler) Handler
HandlerFunc is the definition of any Handler of this Web API framework the function `next()` returns the next handler to call, it is usually returned in any non-error case, otherwise an error handler should be returned instead.
func NewNativeHandlerFunc ¶
func NewNativeHandlerFunc(handler http.Handler) HandlerFunc
NewNativeHandlerFunc creates an intermediate Handler from a net/http Handler.
type ParsedRequest ¶
ParsedRequest is an enriched version of the native http.Request which contains the parsed PathParams as well as an optional State Variable to exchange Data between successive Handlers.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a type used to route HTTP Requests to a specific handler. The router is also capable of parsing path params if the routeConfig's regex supports named capture groups.