Documentation ¶
Index ¶
- func NewTimer(logger logrus.FieldLogger, handler http.Handler) http.Handler
- type Handler
- func (h *Handler) AddOkHandler(path string)
- func (h *Handler) Handle(path string, handler http.Handler) *mux.Route
- func (h *Handler) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) *mux.Route
- func (h *Handler) HandleFuncPrefix(prefix string, f func(http.ResponseWriter, *http.Request)) *mux.Route
- func (h *Handler) HandlePrefix(prefix string, handler http.Handler) *mux.Route
- func (h *Handler) Serve()
- func (h *Handler) SetGracefulShutdownDuration(duration time.Duration)
- type OkHandler
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a custom wrapper around http.Server that cares about graceful termination.
func NewHandler ¶
func NewHandler(logger logrus.FieldLogger, listen, metricsListen string) *Handler
NewHandler constructs the whole internal HTTP routing / handlers
func NewHandlerWithContext ¶
func NewHandlerWithContext(ctx context.Context, logger logrus.FieldLogger, listen, metricsListen string) *Handler
NewHandlerWithContext constructs the whole internal HTTP routing / handlers and accepts a context
func (*Handler) AddOkHandler ¶
AddOkHandler adds an OKHandler to the given path. Useful for custom uptime check or health check URLs.
func (*Handler) Handle ¶
Handle registers a new route with a matcher for the URL path. See Route.Path() and Route.Handler(). Wrapper around mux.router.
func (*Handler) HandleFunc ¶
HandleFunc registers a new route with a matcher for the URL path. See Route.Path() and Route.HandlerFunc(). Wrapper around mux.router.
func (*Handler) HandleFuncPrefix ¶
func (h *Handler) HandleFuncPrefix(prefix string, f func(http.ResponseWriter, *http.Request)) *mux.Route
HandleFuncPrefix registers a new route with a matcher for the URL path. See Route.Prefix() and Route.HandleFunc(). Wrapper around mux.router.
func (*Handler) HandlePrefix ¶
HandlePrefix registers a new route with a matcher for the URL path. See Route.Prefix() and Route.Handler(). Wrapper around mux.router.
func (*Handler) Serve ¶
func (h *Handler) Serve()
Serve starts the server and blocks until the process is terminated by signals
func (*Handler) SetGracefulShutdownDuration ¶
SetGracefulShutdownDuration overrides the default duration to wait for requests to be finished during graceful shutdown before it is enforced
type OkHandler ¶
type OkHandler struct {
// contains filtered or unexported fields
}
OkHandler handles http requests and answers with "ok" :)
func NewOkHandler ¶
func NewOkHandler(logger logrus.FieldLogger) *OkHandler
NewOkHandler returns a new OkHandler instance