rt-limit
v1.0.1
Published
A simple IP address based rate limiting module written in Typescript with zero dependencies.
Downloads
3
Readme
RT Limit
A simple IP address based rate limiting module written in Typescript with zero dependencies.
See how it's implemented at my blog post.
Installation
npm i rt-limit
Usage
import Ratelimit from 'rt-limit';
import express from 'express';
const ratelimit = new Ratelimit(60, 60 * 1000);
const app = express();
app.use((req, res, next) => {
if (ratelimit.consume(req.ip, 1)) {
next();
return;
}
res.status(429).end();
});