Documentation ¶
Index ¶
- Constants
- Variables
- func New(logger logger.Logger) chi.Router
- type ChiWrapper
- func (wrapper *ChiWrapper) Connect(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Delete(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Get(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Group(fn func(r Router))
- func (wrapper *ChiWrapper) Handle(pattern string, h http.Handler)
- func (wrapper *ChiWrapper) HandleFunc(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Head(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Method(method, pattern string, h http.Handler)
- func (wrapper *ChiWrapper) MethodFunc(method, pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) MethodNotAllowed(h http.HandlerFunc)
- func (wrapper *ChiWrapper) Mount(pattern string, h http.Handler)
- func (wrapper *ChiWrapper) NotFound(h http.HandlerFunc)
- func (wrapper *ChiWrapper) Options(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Patch(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Post(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Put(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Route(pattern string, fn func(r Router))
- func (wrapper *ChiWrapper) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (wrapper *ChiWrapper) Trace(pattern string, h http.HandlerFunc)
- func (wrapper *ChiWrapper) Use(middlewares ...Middleware)
- type Config
- type Middleware
- type MiddlewareFunc
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Connect(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Delete(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Get(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Group(fn func(r Router))
- func (reConfiguration *ReConfiguration) Handle(pattern string, h http.Handler)
- func (reConfiguration *ReConfiguration) HandleFunc(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Head(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Method(method, pattern string, h http.Handler)
- func (reConfiguration *ReConfiguration) MethodFunc(method, pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) MethodNotAllowed(h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Mount(pattern string, h http.Handler)
- func (reConfiguration *ReConfiguration) NotFound(h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Options(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Patch(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Post(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Put(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
- func (reConfiguration *ReConfiguration) Route(pattern string, fn func(r Router))
- func (reConfiguration *ReConfiguration) Router() Router
- func (reConfiguration *ReConfiguration) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (reConfiguration *ReConfiguration) Trace(pattern string, h http.HandlerFunc)
- func (reConfiguration *ReConfiguration) Use(middlewares ...Middleware)
- type Router
Constants ¶
View Source
const ( UseProfileFieldName = "trace.pprof" HealthCheckEndpointFieldName = "server.http.routes.health_check" MetricsEndpointFieldName = "server.http.routes.metrics" PprofEndpointFieldName = "server.http.routes.pprof" UseProfileDefault = false HealthCheckEndpointDefault = "/health-check" MetricsEndpointDefault = "/metrics" PprofEndpointDefault = "/debug" )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(reConfiguration *ReConfiguration) Router { return reConfiguration }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.BoolVar(&config.UseProfile, UseProfileFieldName, UseProfileDefault, "if true, add debug path to routing") flagSet.StringVar(&config.HealthCheckEndpoint, HealthCheckEndpointFieldName, HealthCheckEndpointDefault, "path for liveness test endpoint") flagSet.StringVar(&config.MetricsEndpoint, MetricsEndpointFieldName, MetricsEndpointDefault, "path for metrics endpoint") flagSet.StringVar(&config.PprofEndpoint, PprofEndpointFieldName, PprofEndpointDefault, "path for debug endpoint") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( reConfiguration reConfiguration.ReConfiguration, informer logger.Informer, router *ReConfiguration, ) { reConfiguration.Registration(router) informer.Info("http.server.router: registration in the reConfigurator") }) }), }
Functions ¶
Types ¶
type ChiWrapper ¶
type ChiWrapper struct {
// contains filtered or unexported fields
}
func NewChiWrapper ¶
func NewChiWrapper(router chi.Router) *ChiWrapper
func (*ChiWrapper) Connect ¶
func (wrapper *ChiWrapper) Connect(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Delete ¶
func (wrapper *ChiWrapper) Delete(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Get ¶
func (wrapper *ChiWrapper) Get(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Group ¶
func (wrapper *ChiWrapper) Group(fn func(r Router))
func (*ChiWrapper) HandleFunc ¶
func (wrapper *ChiWrapper) HandleFunc(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Head ¶
func (wrapper *ChiWrapper) Head(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Method ¶
func (wrapper *ChiWrapper) Method(method, pattern string, h http.Handler)
func (*ChiWrapper) MethodFunc ¶
func (wrapper *ChiWrapper) MethodFunc(method, pattern string, h http.HandlerFunc)
func (*ChiWrapper) MethodNotAllowed ¶
func (wrapper *ChiWrapper) MethodNotAllowed(h http.HandlerFunc)
func (*ChiWrapper) NotFound ¶
func (wrapper *ChiWrapper) NotFound(h http.HandlerFunc)
func (*ChiWrapper) Options ¶
func (wrapper *ChiWrapper) Options(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Patch ¶
func (wrapper *ChiWrapper) Patch(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Post ¶
func (wrapper *ChiWrapper) Post(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Put ¶
func (wrapper *ChiWrapper) Put(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Route ¶
func (wrapper *ChiWrapper) Route(pattern string, fn func(r Router))
func (*ChiWrapper) ServeHTTP ¶
func (wrapper *ChiWrapper) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*ChiWrapper) Trace ¶
func (wrapper *ChiWrapper) Trace(pattern string, h http.HandlerFunc)
func (*ChiWrapper) Use ¶
func (wrapper *ChiWrapper) Use(middlewares ...Middleware)
type Config ¶
type Config struct { UseProfile bool HealthCheckEndpoint string MetricsEndpoint string PprofEndpoint string }
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type MiddlewareFunc ¶
func (MiddlewareFunc) Middleware ¶
func (m MiddlewareFunc) Middleware(next http.Handler) http.Handler
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfiguration(logger logger.Logger, config *Config) *ReConfiguration
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(logger logger.Logger, config *Config, configurator configurator.Configurator) *ReConfiguration
func (*ReConfiguration) Connect ¶
func (reConfiguration *ReConfiguration) Connect(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Delete ¶
func (reConfiguration *ReConfiguration) Delete(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Get ¶
func (reConfiguration *ReConfiguration) Get(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Group ¶
func (reConfiguration *ReConfiguration) Group(fn func(r Router))
func (*ReConfiguration) Handle ¶
func (reConfiguration *ReConfiguration) Handle(pattern string, h http.Handler)
func (*ReConfiguration) HandleFunc ¶
func (reConfiguration *ReConfiguration) HandleFunc(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Head ¶
func (reConfiguration *ReConfiguration) Head(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Method ¶
func (reConfiguration *ReConfiguration) Method(method, pattern string, h http.Handler)
func (*ReConfiguration) MethodFunc ¶
func (reConfiguration *ReConfiguration) MethodFunc(method, pattern string, h http.HandlerFunc)
func (*ReConfiguration) MethodNotAllowed ¶
func (reConfiguration *ReConfiguration) MethodNotAllowed(h http.HandlerFunc)
func (*ReConfiguration) Mount ¶
func (reConfiguration *ReConfiguration) Mount(pattern string, h http.Handler)
func (*ReConfiguration) NotFound ¶
func (reConfiguration *ReConfiguration) NotFound(h http.HandlerFunc)
func (*ReConfiguration) Options ¶
func (reConfiguration *ReConfiguration) Options(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Patch ¶
func (reConfiguration *ReConfiguration) Patch(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Post ¶
func (reConfiguration *ReConfiguration) Post(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Put ¶
func (reConfiguration *ReConfiguration) Put(pattern string, h http.HandlerFunc)
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
func (*ReConfiguration) Route ¶
func (reConfiguration *ReConfiguration) Route(pattern string, fn func(r Router))
func (*ReConfiguration) Router ¶
func (reConfiguration *ReConfiguration) Router() Router
func (*ReConfiguration) ServeHTTP ¶
func (reConfiguration *ReConfiguration) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*ReConfiguration) Trace ¶
func (reConfiguration *ReConfiguration) Trace(pattern string, h http.HandlerFunc)
func (*ReConfiguration) Use ¶
func (reConfiguration *ReConfiguration) Use(middlewares ...Middleware)
type Router ¶
type Router interface { http.Handler Use(middlewares ...Middleware) Group(fn func(r Router)) Route(pattern string, fn func(r Router)) Mount(pattern string, h http.Handler) Handle(pattern string, h http.Handler) HandleFunc(pattern string, h http.HandlerFunc) Method(method, pattern string, h http.Handler) MethodFunc(method, pattern string, h http.HandlerFunc) Connect(pattern string, h http.HandlerFunc) Delete(pattern string, h http.HandlerFunc) Get(pattern string, h http.HandlerFunc) Head(pattern string, h http.HandlerFunc) Options(pattern string, h http.HandlerFunc) Patch(pattern string, h http.HandlerFunc) Post(pattern string, h http.HandlerFunc) Put(pattern string, h http.HandlerFunc) Trace(pattern string, h http.HandlerFunc) NotFound(h http.HandlerFunc) MethodNotAllowed(h http.HandlerFunc) }
Click to show internal directories.
Click to hide internal directories.