Documentation
¶
Overview ¶
Package router wraps the standard library's net/http.ServeMux (Go 1.22+ method+path patterns) with go-pkgz/routegroup for nestable groups and per-group middleware, and bridges the typed rest.HandlerFunc into the mux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
Middleware is standard net/http middleware.
type Router ¶
type Router struct {
*routegroup.Bundle
// contains filtered or unexported fields
}
Router is a thin wrapper over routegroup.Bundle that additionally knows how to mount typed rest.HandlerFunc handlers. The zero value is not usable; use New.
func New ¶
New creates a Router backed by a fresh ServeMux. appMids are applied to every handler registered via HandleApp (e.g. error mapping, auth), outermost first.
func (*Router) HandleApp ¶
HandleApp registers a typed rest.HandlerFunc. The router's appMids plus any per-route mids are applied, and the result is adapted to http and encoded via rest.Respond.
func (*Router) With ¶
func (r *Router) With(mws ...Middleware) *Router
With returns a sub-router with the given net/http middleware applied.