Documentation
¶
Overview ¶
Package mux implements a request router and dispatcher for matching incoming requests to their respective handler.
Inspired by:
https://github.com/nmerouze/stack
Usage ¶
router := mux.NewRouter() router.Use(globalMiddleware1, globalMiddleware2, ...) router.Handle(method, pattern).Use(middleware1, middleware2, ...).Then(handler) http.ListenAndServe(addr, router) See cmd/server/main.go for example.
Index ¶
- func Params(r *http.Request) map[string]string
- type Mux
- func (m *Mux) DELETE(p string) *route
- func (m *Mux) GET(p string) *route
- func (m *Mux) Handle(method string, pattern string) *route
- func (m *Mux) PATCH(p string) *route
- func (m *Mux) POST(p string) *route
- func (m *Mux) PUT(p string) *route
- func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Mux) Use(middlewares ...middleware) *Mux
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mux ¶
type Mux struct {
NotFound http.HandlerFunc
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.