Documentation
¶
Index ¶
- func BodyLimit(limit int64) goexpress.Middleware
- func CORS(config ...CORSConfig) goexpress.Middleware
- func Logger() goexpress.Middleware
- func RateLimit(config RateLimitConfig) goexpress.Middleware
- func Recovery() goexpress.Middleware
- func Secure() goexpress.Middleware
- type CORSConfig
- type RateLimitConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyLimit ¶
func BodyLimit(limit int64) goexpress.Middleware
BodyLimit limits the size of request bodies
func RateLimit ¶
func RateLimit(config RateLimitConfig) goexpress.Middleware
RateLimit returns a rate limiting middleware (simple in-memory implementation)
func Recovery ¶
func Recovery() goexpress.Middleware
Recovery recovers from panics and returns a 500 error
Types ¶
type CORSConfig ¶
type CORSConfig struct {
AllowOrigins []string
AllowMethods []string
AllowHeaders []string
ExposeHeaders []string
AllowCredentials bool
MaxAge int
}
CORSConfig holds CORS configuration
func DefaultCORSConfig ¶
func DefaultCORSConfig() CORSConfig
DefaultCORSConfig returns a default CORS configuration
type RateLimitConfig ¶
type RateLimitConfig struct {
Max int // Maximum requests
Window time.Duration // Time window
KeyFunc func(*goexpress.Context) string
Handler goexpress.HandlerFunc
}
RateLimitConfig holds rate limiting configuration
Click to show internal directories.
Click to hide internal directories.