Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
Middleware is a function that wraps an http.Handler.
func APIKey ¶
func APIKey(apiKeys []string, logger log.Logger) Middleware
APIKey returns a middleware that checks for a valid API key.
func CORS ¶
func CORS() Middleware
CORS returns a middleware that adds CORS headers to the response.
func Chain ¶
func Chain(middlewares ...Middleware) Middleware
Chain combines multiple middleware into a single middleware.
func Logger ¶
func Logger(logger log.Logger) Middleware
Logger returns a middleware that logs HTTP requests.
func Recovery ¶
func Recovery(logger log.Logger) Middleware
Recovery returns a middleware that recovers from panics.
func Timeout ¶
func Timeout(timeout time.Duration) Middleware
Timeout returns a middleware that adds a timeout to the request context.
Click to show internal directories.
Click to hide internal directories.