Documentation
¶
Index ¶
- func AllowedHosts(next http.Handler) http.Handler
- func CacheControl(duration time.Duration) func(next http.Handler) http.Handler
- func GenerateRequestID() string
- func GetRequestID(ctx context.Context) string
- func GetUserFromContext(ctx context.Context) *models.User
- func Logger(baseLogger *zerolog.Logger) func(next http.Handler) http.Handler
- func SecurityHeaders(next http.Handler) http.Handler
- func ValidateApiKey(store db.DB) func(next http.Handler) http.Handler
- func ValidateSession(store db.DB) func(next http.Handler) http.Handler
- func WithRequestID(next http.Handler) http.Handler
- type MiddlwareContextKey
- type RequestIDHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheControl ¶ added in v0.1.30
func GenerateRequestID ¶
func GenerateRequestID() string
func GetRequestID ¶
GetRequestID extracts the request ID from context
func Logger ¶
Logger logs requests and injects a request-scoped logger with a request ID into the context.
func SecurityHeaders ¶ added in v0.1.30
SecurityHeaders adds standard security headers to every response
Types ¶
type MiddlwareContextKey ¶
type MiddlwareContextKey string
const (
UserContextKey MiddlwareContextKey = "user"
)
type RequestIDHook ¶
type RequestIDHook struct{}
Click to show internal directories.
Click to hide internal directories.