
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
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 41 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.