Documentation
¶
Index ¶
- func Compose(handler http.Handler, middlewares ...Middleware) http.Handler
- func Create(config Config) http.Handler
- func Etag(handler http.Handler) http.Handler
- func Logger(handler http.Handler) http.Handler
- func Recover(handler http.Handler) http.Handler
- type AppHeaders
- type AuthConfig
- type Config
- type EtagWriter
- type HealthConfig
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
func Compose(handler http.Handler, middlewares ...Middleware) http.Handler
Compose adds middleware handlers to a given handler. Middleware handlers are ordered from first to last.
func Create ¶
Create returns the default middleware composition, useful for all general services. Middleware should be added in a specific order. If any new middleware depends on other middleware, the new middleware should follow afterward.
Types ¶
type AppHeaders ¶
AppHeaders holds app specific header values
type AuthConfig ¶
type AuthConfig struct {
WhiteList []string
APIKeyName string
SecretKey string
ErrorMessage string
}
AuthConfig holds the necessary values for the authentication middleware
type Config ¶
type Config struct {
Auth bool
AppName string
AppVersion string
Compress bool
EnvVarsToValidate []string
Etag bool
GitRevision string
Handler http.Handler
Region string
SecureOptions secure.Options
WhiteList []string
}
Config holds the values needed for Create()
type EtagWriter ¶ added in v0.1.1
type EtagWriter struct {
middleware.WrapResponseWriter
// contains filtered or unexported fields
}
EtagWriter provides a ResponseWriter which holds info needed for verifying etags.
type HealthConfig ¶
HealthConfig holds the information required by the Health middleware
type Middleware ¶
Middleware represents the function type for all middleware.
func Headers ¶
func Headers(appHeaders AppHeaders) Middleware
Headers adds more app specific headers to the response
func Health ¶
func Health(config HealthConfig) Middleware
Health provides a route to get an app's health information