Redis client for the express-rate-limit middleware.
$ npm install --save rate-limit-redis
var RateLimit = require('express-rate-limit');
var RedisStore = require('rate-limit-redis');
var limiter = new RateLimit({
store: new RedisStore({
// see Configuration
}),
max: 100, // limit each IP to 100 requests per windowMs
delayMs: 0 // disable delaying - full speed until the max limit is reached
});
// apply to all requests
app.use(limiter);
- expiry: seconds - how long each rate limiting window exists for. Defaults to
60
. - prefix: string - prefix to add to entries in Redis. Defaults to
rl:
. - client: Redis Client or ioredis Client- A Redis Client to use. Defaults to
require('redis').createClient();
.
MIT © Wyatt Johnson, Nathan Friedly