Implement a rate limiter
Add a sliding-window rate limiter middleware that returns 429 with a Retry-After header when the limit is hit. Backed by Redis or an in-memory store.
Preview
Copy prompt
Implement a sliding-window rate limiter middleware for a [Language/Framework] server. The middleware should accept configurable limits for maximum requests and window duration. Return a 429 Too Many Requests response with an appropriate Retry-After header when the limit is exceeded. Use [Redis / in-memory store] as the backing store and show how to attach the middleware to specific routes or the entire server.
More
Code Generation
Prompts
