Documentation
¶
Overview ¶
Package http adapts controller instances to HTTP routing.
Route registration is explicit: controllers implement RouteRegistrar and are invoked via RegisterRoutes. No reflection is used.
NewRouter returns a chi.Router with baseline middleware. Use AsRouter to adapt it to the method-based Router interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ShutdownTimeout = 30 * time.Second
ShutdownTimeout controls how long the server will wait for in-flight requests to finish after receiving a shutdown signal.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes invokes controller route registration functions.
func RequestLogger ¶
RequestLogger returns an HTTP middleware that logs each request with method, path, status, and duration.
Types ¶
type RouteRegistrar ¶
type RouteRegistrar interface {
RegisterRoutes(router Router)
}
RouteRegistrar defines a controller that can register its HTTP routes.
type RouteRegistrationError ¶
type RouteRegistrationError struct {
Name string
}
RouteRegistrationError indicates a controller does not expose route registration.
func (*RouteRegistrationError) Error ¶
func (e *RouteRegistrationError) Error() string