Documentation
¶
Overview ¶
Package chirouter is an opt-in chi-backed nexus router. Select it instead of the default stdlib router when you want chi's matching/features. It adds a single dependency (go-chi/chi) and no transitive deps.
Index ¶
- type Router
- func (r *Router) Any(path string, chain ...httpx.HandlerFunc)
- func (r *Router) DELETE(path string, chain ...httpx.HandlerFunc)
- func (r *Router) GET(path string, chain ...httpx.HandlerFunc)
- func (r *Router) Group(prefix string, mw ...httpx.HandlerFunc) httpx.Group
- func (r *Router) HEAD(path string, chain ...httpx.HandlerFunc)
- func (r *Router) Handle(method, path string, chain ...httpx.HandlerFunc)
- func (r *Router) NoRoute(chain ...httpx.HandlerFunc)
- func (r *Router) OPTIONS(path string, chain ...httpx.HandlerFunc)
- func (r *Router) PATCH(path string, chain ...httpx.HandlerFunc)
- func (r *Router) POST(path string, chain ...httpx.HandlerFunc)
- func (r *Router) PUT(path string, chain ...httpx.HandlerFunc)
- func (r *Router) Routes() []httpx.RouteInfo
- func (r *Router) Run(addr string) error
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Static(prefix, dir string)
- func (r *Router) Use(mw ...httpx.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) NoRoute ¶
func (r *Router) NoRoute(chain ...httpx.HandlerFunc)
func (*Router) ServeHTTP ¶
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP runs app-wide middleware (Use) around the mux so it fires for EVERY request (gin's engine-level semantics); route chains run inside the match.
func (*Router) Use ¶
func (r *Router) Use(mw ...httpx.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.