Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler func(w http.ResponseWriter, r *http.Request) error
Handler is an injectable function which returns an error to help control flow.
type Middleware ¶
Middleware is a wrapper to make it easy to inject middleware in to the web application at different levels.
func New ¶
func New(handler *mux.Router) *Middleware
New takes a mux.Router and prepares it as Middleware.
func NewRouter ¶
func NewRouter() *Middleware
NewRouter will return Middleware with a new Gorilla mux.Router.
func (*Middleware) HandleFunc ¶
func (m *Middleware) HandleFunc(path string, f http.HandlerFunc) *Middleware
HandleFunc takes a string to represent the path and an http.HandlerFunc. This function will then be wrapped with the middleware.
func (*Middleware) Inject ¶
func (m *Middleware) Inject(f ...Handler) *Middleware
Inject takes one or more MiddlewareFunc's and appends them to the current collection.
func (*Middleware) PathPrefix ¶
func (m *Middleware) PathPrefix(path string) *MiddlewareRoute
PathPrefix return a new MiddlewareRoute based on the path prefix.
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP can be passed to the http.ListenAndServe() function.
type MiddlewareRoute ¶
MiddlewareRoute represents a route.
func (*MiddlewareRoute) Subrouter ¶
func (mr *MiddlewareRoute) Subrouter() *Middleware
Subrouter creates a new Middleware router based on the route.