Documentation ¶
Index ¶
- type HandlerFunc
- type Mux
- func (m *Mux) BadRequest(w http.ResponseWriter, r *http.Request)
- func (m *Mux) Delete(path string, fn HandlerFunc)
- func (m *Mux) Get(path string, fn HandlerFunc)
- func (m *Mux) Head(path string, fn HandlerFunc)
- func (m *Mux) NotFound(w http.ResponseWriter, r *http.Request)
- func (m *Mux) Options(path string, fn HandlerFunc)
- func (m *Mux) Param(r *http.Request, param string) string
- func (m *Mux) Patch(path string, fn HandlerFunc)
- func (m *Mux) Post(path string, fn HandlerFunc)
- func (m *Mux) Put(path string, fn HandlerFunc)
- func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is used to wrapper all endpoint functions so they work with generic routers.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux contains the router.
func New ¶
func New(csh func(w http.ResponseWriter, r *http.Request, status int, err error), notFound http.Handler) *Mux
New returns an instance of the router.
func (*Mux) BadRequest ¶
func (m *Mux) BadRequest(w http.ResponseWriter, r *http.Request)
BadRequest shows the 400 page.
func (*Mux) Delete ¶
func (m *Mux) Delete(path string, fn HandlerFunc)
Delete is a shortcut for router.Handle("DELETE", path, handle)
func (*Mux) Get ¶
func (m *Mux) Get(path string, fn HandlerFunc)
Get registers handler on path for both GET and HEAD verbs
func (*Mux) Head ¶
func (m *Mux) Head(path string, fn HandlerFunc)
Head is a shortcut for router.Handle("HEAD", path, handle)
func (*Mux) NotFound ¶
func (m *Mux) NotFound(w http.ResponseWriter, r *http.Request)
NotFound shows the 404 page.
func (*Mux) Options ¶
func (m *Mux) Options(path string, fn HandlerFunc)
Options is a shortcut for router.Handle("OPTIONS", path, handle)
func (*Mux) Patch ¶
func (m *Mux) Patch(path string, fn HandlerFunc)
Patch is a shortcut for router.Handle("PATCH", path, handle)
func (*Mux) Post ¶
func (m *Mux) Post(path string, fn HandlerFunc)
Post is a shortcut for router.Handle("POST", path, handle)
func (*Mux) Put ¶
func (m *Mux) Put(path string, fn HandlerFunc)
Put is a shortcut for router.Handle("PUT", path, handle)