Documentation ¶
Overview ¶
Package router provides request handling capabilities.
Index ¶
- type Mux
- func (m *Mux) Delete(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Error(status int, w http.ResponseWriter, r *http.Request)
- func (m *Mux) Get(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Handle(method string, path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Head(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Options(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Param(r *http.Request, param string) string
- func (m *Mux) Patch(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Post(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) Put(path string, fn func(http.ResponseWriter, *http.Request) error)
- func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Mux) SetNotFound(notFound http.Handler)
- func (m *Mux) SetServeHTTP(csh func(w http.ResponseWriter, r *http.Request, err error))
- func (m *Mux) StatusError(status int, err error) error
- func (m *Mux) Wrap(handler http.HandlerFunc) func(w http.ResponseWriter, r *http.Request) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux contains the router.
func (*Mux) ServeHTTP ¶
func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP routes the incoming http.Request based on method and path extracting path parameters as it goes.
func (*Mux) SetNotFound ¶
SetNotFound sets the NotFound function.
func (*Mux) SetServeHTTP ¶
SetServeHTTP sets the ServeHTTP function.
func (*Mux) StatusError ¶
StatusError returns error with a status code.
func (*Mux) Wrap ¶
func (m *Mux) Wrap(handler http.HandlerFunc) func(w http.ResponseWriter, r *http.Request) (err error)
Wrap a standard http handler so it can be used easily.
Click to show internal directories.
Click to hide internal directories.