Documentation ¶
Overview ¶
Package mux provides some basic implementations for building routers based on net/http mux
Index ¶
- Constants
- Variables
- func DebugHandler(logger log.Logger) http.HandlerFunc
- func DefaultEngine() *engine
- func DefaultFactory(pf proxy.Factory, logger log.Logger) route.Factory
- func HealthHandler(w http.ResponseWriter, r *http.Request)
- func NewFactory(cfg Config) route.Factory
- func NoopParamExtractor(_ *http.Request) map[string]string
- func RegisterRender(name string, r Render)
- type Config
- type Engine
- type HTTPErrorInterceptor
- type HandlerFactory
- type HandlerMiddleware
- type ParamExtractor
- type Render
- type RequestBuilder
- type RunServerFunc
Constants ¶
View Source
const DefaultDebugPattern = "/__debug/"
View Source
const NEGOTIATE = "negotiate"
Variables ¶
View Source
var EndpointHandler = CustomEndpointHandler(NewRequest)
View Source
var NewRequest = NewRequestBuilder(NoopParamExtractor)
Functions ¶
func DebugHandler ¶
func DebugHandler(logger log.Logger) http.HandlerFunc
func DefaultEngine ¶
func DefaultEngine() *engine
func HealthHandler ¶
func HealthHandler(w http.ResponseWriter, r *http.Request)
func NewFactory ¶
func RegisterRender ¶
Types ¶
type Config ¶
type Config struct { Engine Engine Middlewares []HandlerMiddleware HandlerFactory HandlerFactory ProxyFactory proxy.Factory Logger log.Logger DebugPattern string RunServer RunServerFunc }
type HTTPErrorInterceptor ¶
type HTTPErrorInterceptor struct { http.ResponseWriter // contains filtered or unexported fields }
func NewHTTPErrorInterceptor ¶
func NewHTTPErrorInterceptor(w http.ResponseWriter) *HTTPErrorInterceptor
func (*HTTPErrorInterceptor) WriteHeader ¶
func (i *HTTPErrorInterceptor) WriteHeader(code int)
type HandlerFactory ¶
type HandlerFactory func(*config.EndpointConfig, proxy.Proxy) http.HandlerFunc
func CustomEndpointHandler ¶
func CustomEndpointHandler(rb RequestBuilder) HandlerFactory
func CustomEndpointHandlerWithHTTPError ¶
func CustomEndpointHandlerWithHTTPError(rb RequestBuilder, errF server.ToHTTPError) HandlerFactory
type RequestBuilder ¶
func NewRequestBuilder ¶
func NewRequestBuilder(paramExtractor ParamExtractor) RequestBuilder
type RunServerFunc ¶
Click to show internal directories.
Click to hide internal directories.