@usmantariqdev/super-rate-limiter
v1.0.0
Published
Flexible and powerful rate limiter & throttling middleware for Node.js frameworks like Express, Koa, and Fastify.
Maintainers
Readme
super-rate-limiter
Flexible and powerful rate limiter & throttling middleware for Node.js frameworks like Express, Koa, and Fastify.
Installation
npm install super-rate-limiter
**Usage**
import express from 'express';
import rateLimiter from 'rate-limiter';
const app = express();
app.use(rateLimiter({
windowMs: 15 * 60 * 1000, // 15 minutes
maxRequests: 100, // limit each IP to 100 requests per windowMs
message: 'Too many requests, please try again later.',
statusCode: 429, // HTTP status code when limit exceeded
}));
app.get('/', (req, res) => {
res.send('Hello, world!');
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});