Documentation
¶
Overview ¶
Package chi provides some basic implementations for building routers based on go-chi/chi
Index ¶
Constants ¶
const ChiDefaultDebugPattern = "/__debug/"
ChiDefaultDebugPattern is the default pattern used to define the debug endpoint
Variables ¶
This section is empty.
Functions ¶
func DefaultFactory ¶
DefaultFactory returns a chi router factory with the injected proxy factory and logger. It also uses a default chi router and the default HandlerFactory
func NewEndpointHandler ¶
func NewEndpointHandler(cfg *config.EndpointConfig, prxy proxy.Proxy) http.HandlerFunc
NewEndpointHandler implements the HandleFactory interface using the default ToHTTPError function
func NewFactory ¶
NewFactory returns a chi router factory with the injected configuration
Types ¶
type Config ¶
type Config struct {
Engine chi.Router
Middlewares chi.Middlewares
HandlerFactory HandlerFactory
ProxyFactory proxy.Factory
Logger logging.Logger
DebugPattern string
RunServer RunServerFunc
}
Config is the struct that collects the parts the router should be builded from
type HandlerFactory ¶
type HandlerFactory func(*config.EndpointConfig, proxy.Proxy) http.HandlerFunc
HandlerFactory creates a handler function that adapts the chi router with the injected proxy
type RunServerFunc ¶
RunServerFunc is a func that will run the http Server with the given params.