Documentation
¶
Index ¶
- Variables
- type Handler
- type Mux
- func (m *Mux) Delete(path string, fn Handler)
- func (m *Mux) Get(path string, fn Handler)
- func (m *Mux) Head(path string, fn Handler)
- func (m *Mux) Instance() *way.Router
- func (m *Mux) Options(path string, fn Handler)
- func (m *Mux) Param(r *http.Request, param string) string
- func (m *Mux) Patch(path string, fn Handler)
- func (m *Mux) Post(path string, fn Handler)
- func (m *Mux) Put(path string, fn Handler)
- func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
var DefaultServeHTTP = func(w http.ResponseWriter, r *http.Request, status int, err error) { if status >= 400 { if err != nil { http.Error(w, err.Error(), status) } else { http.Error(w, "", status) } } }
DefaultServeHTTP is the default ServeHTTP function that receives the status and error from the function call.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler is used to wrapper all endpoint functions so they work with generic routers.
type Mux ¶
type Mux struct { // CustomServeHTTP is a settable serve function. CustomServeHTTP func(w http.ResponseWriter, r *http.Request, status int, err error) // contains filtered or unexported fields }
Mux contains the router.
func (*Mux) Delete ¶
Delete is a shortcut for router.Handle("DELETE", path, handle)
func (*Mux) Get ¶
Get is a shortcut for router.Handle("GET", path, handle)
func (*Mux) Head ¶
Head is a shortcut for router.Handle("HEAD", path, handle)
func (*Mux) Options ¶
Options is a shortcut for router.Handle("OPTIONS", path, handle)
func (*Mux) Param ¶
Param returns a URL parameter.
func (*Mux) Patch ¶
Patch is a shortcut for router.Handle("PATCH", path, handle)
func (*Mux) Post ¶
Post is a shortcut for router.Handle("POST", path, handle)
func (*Mux) Put ¶
Put is a shortcut for router.Handle("PUT", path, handle)