Documentation
¶
Index ¶
- Constants
- Variables
- type Handler
- type HandlerFunc
- type HandlerID
- type Param
- type Params
- type Router
- func (r *Router) Add(method, path string, handlerID HandlerID) error
- func (r *Router) AddHandler(handler Handler) HandlerID
- func (r *Router) AddStdHandler(handler http.Handler) HandlerID
- func (r *Router) FindHandler(method, path string) (Handler, error)
- func (r *Router) GetHandler(hID HandlerID) (Handler, error)
- func (r *Router) RegisterHandler(method, path string, handler Handler) error
- func (r *Router) Remove(method, path string) error
- func (r *Router) RemoveHandler(hID HandlerID)
- func (r *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Constants ¶
View Source
const MethodAny = "ANY"
Variables ¶
View Source
var HandlerKeyUserValue = "stdprouter.handler_id"
View Source
var ParamsKey = paramsKey{}
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request, Params)
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request, p Params)
type Params ¶
type Params []Param
func ParamsFromContext ¶
ParamsFromContext pulls the URL parameters from a request context, or returns nil if none are present.
type Router ¶
type Router struct { PageNotFoundHandler http.HandlerFunc MethodNotAllowedHandler http.HandlerFunc GlobalHandler Handler Trees []radix.Tree // contains filtered or unexported fields }
func (*Router) AddHandler ¶
func (*Router) RegisterHandler ¶
func (*Router) RemoveHandler ¶
Click to show internal directories.
Click to hide internal directories.