
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
express-rate-limit-redis
Advanced tools
An express rate-limiting middleware using redis as its storage
An express rate-limiting middleware using redis as its storage
npm i express-rate-limit-redis
const express = require('express');
const app = express();
const RateLimiter = require('express-rate-limit-redis');
const Redis = require('ioredis');
const client = new Redis();
const limiter = RateLimiter({
client,
id: 'verify-phone-number',
max: 3, // limit each IP to 3 requests per windowMs
windowMs: 60 * 1000, // 1 minute
});
app.use('/verify-phone-number', limiter);
app.get('/verify-phone-number', (req, res) => {
res.json({
msg: 'ok',
});
});
const limiter2 = RateLimiter({
client,
id: 'change-password',
max: 1, // limit each IP to 1 requests per windowMs
windowMs: 10 * 60 * 1000, // 10 minute
});
app.get('/change-password', limiter2, (req, res) => {
res.json({
msg: 'ok',
});
});
const { PORT = 8080 } = process.env;
app.listen(PORT);
console.log(`server running on http://localhost:${PORT}`);
# install dependency
npm i
# ts to js
npm run build
# start example server
node example/server.jss
http://localhost:8080/verify-phone-number
Identifier of a limiter, to support multiple rate-limiter
Max number of connections during windowMs milliseconds before sending a 429 response.
How long in milliseconds to keep records of requests in memory.
req.ip
, but on params of req
FAQs
An express rate-limiting middleware using redis as its storage
The npm package express-rate-limit-redis receives a total of 8 weekly downloads. As such, express-rate-limit-redis popularity was classified as not popular.
We found that express-rate-limit-redis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.