rate-limiter-rediss
v1.1.0
Published
A Rate Limiter is a tool used to control the rate of requests a user or client can make to an API or service. This helps prevent abuse, overloading, or denial-of-service (DoS) attacks and ensures fair usage among multiple users. This NPM package is design
Downloads
104
Readme
Rate Limiter NPM Package
A simple rate limiter for limiting the number of requests a user can make within a specified time window.
Installation
npm install your-package-name
```Usage
const RateLimiter = require('your-package-name');
const limiter = new RateLimiter(10, 60000); // 10 requests per minute
const userId = 'user123';
if (limiter.isRateLimited(userId)) {
console.log('Rate limit exceeded. Try again later.');
} else {
console.log('Request allowed.');
}