Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware func(next fasthttp.RequestHandler) fasthttp.RequestHandler
Middleware wraps a fasthttp handler with additional behaviour.
func CORS ¶
func CORS() Middleware
CORS adds Cross-Origin Resource Sharing headers and handles preflight.
func Chain ¶
func Chain(mws ...Middleware) Middleware
Chain composes middlewares left-to-right: the first argument wraps outermost.
Chain(Recovery(), Logging(), SecureHeaders())(h) // request path: Recovery → Logging → SecureHeaders → h
func Logging ¶
func Logging() Middleware
Logging records method, path, remote addr, status code and latency for every request.
func RateLimit ¶
func RateLimit(lim *limiter.Limiter) Middleware
RateLimit rejects requests with 429 when the per-second budget is exhausted.
func Recovery ¶
func Recovery() Middleware
Recovery catches panics, logs them with a stack trace, and returns 500.
func RequestID ¶
func RequestID() Middleware
RequestID sets X-Request-ID on the response if the client did not send one.
func SecureHeaders ¶
func SecureHeaders() Middleware
SecureHeaders adds common security response headers.
Click to show internal directories.
Click to hide internal directories.