Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTooManyStars is returned if there are multiple *params in the path ErrTooManyStars = errors.New("too many stars") // ErrStarNotLast is returned if *param is not the last part of the path. ErrStarNotLast = errors.New("star param must be the last part of the path") )
Functions ¶
func DefaultNotFoundHandler ¶
func DefaultNotFoundHandler(w http.ResponseWriter, req *http.Request, _ Params)
DefaultNotFoundHandler is the default panic handler
func DefaultPanicHandler ¶
func DefaultPanicHandler(w http.ResponseWriter, req *http.Request, v interface{})
DefaultPanicHandler is the default panic handler
Types ¶
type Handler ¶
type Handler func(w http.ResponseWriter, req *http.Request, p Params)
Handler is what handler looks like, duh? *note* `p` is NOT safe to be used outside the handler, call p.Copy() if you need to use it.
type OnRequestDone ¶
type Options ¶
type Options struct { OnRequestDone NoAutoCleanURL bool // don't automatically clean URLs, not recommended NoDefaultPanicHandler bool // don't use the default panic handler NoPanicOnInvalidAddRoute bool // don't panic on invalid routes, return an error instead NoCatchPanics bool // don't catch panics NoAutoHeadToGet bool // disable automatically handling HEAD requests ProfileLabels bool }
Options passed to the router
type PanicHandler ¶
type PanicHandler func(w http.ResponseWriter, req *http.Request, v interface{})
PanicHandler is a special handler that gets called if a panic happens
type Params ¶
type Params []Param
Params handles the named params in your url, it is *NOT* safe to be used outside of your handler.
type Router ¶
type Router struct { NotFoundHandler Handler MethodNotAllowedHandler Handler PanicHandler PanicHandler // contains filtered or unexported fields }
Router is an efficient routing library
func (*Router) AddRoute ¶
AddRoute adds a Handler to the specific method and route. Calling AddRoute after starting the http server is racy and not supported.
Click to show internal directories.
Click to hide internal directories.