Documentation
¶
Overview ¶
Package router provides utils to add middleware handlers to http handler functions.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware func(http.HandlerFunc) http.HandlerFunc
type Router ¶
type Router map[string]handler
func (*Router) Add ¶
func (r *Router) Add(mw ...Middleware)
Add middleware handlers to all routes. See AddRoute for more details.
func (*Router) AddRoute ¶
func (r *Router) AddRoute(route string, mw ...Middleware)
AddRoute adds middleware handlers to the given route. Middleware will executed in the order provided.
func (*Router) Build ¶
func (r *Router) Build()
Build registers all middleware and http handlers set until now. This method must be called when all middleware and http handlers have been added.
func (*Router) HandlerFunc ¶
func (r *Router) HandlerFunc(route string, h http.HandlerFunc)
HandlerFunc sets the handler function to the given route. There can be only one handler function per route.
Click to show internal directories.
Click to hide internal directories.