Function: rateLimit()
ts
function rateLimit(config): RateLimitMiddleware;Defined in: packages/core/src/core/middleware/RateLimiter.ts:244
Create a rate limiting middleware.
Returns a self-healing toolError('RATE_LIMITED') with retryAfterSeconds when the limit is exceeded, following RFC 7231 semantics.
The returned middleware exposes a destroy() method to clean up the underlying store (intervals, connections). Call it on server shutdown or in test afterEach hooks to prevent timer leaks.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | RateLimitConfig | Rate limit configuration |
Returns
A middleware function compatible with .use(), with destroy()