@extensis/rate-limit-redis
TypeScript icon, indicating that this package has built-in type declarations

1.5.2 • Public • Published

Rate Limit Redis

Build Status NPM version Dependency Status Development Dependency Status

Redis client for the express-rate-limit middleware.

Install

$ npm install --save rate-limit-redis

Usage

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);

Configuration

  • expiry: seconds - how long each rate limiting window exists for. Defaults to 60.
  • resetExpiryOnCount: number - if the rate limiting count is greater than this number, the expiry time should be reset every time a key is incremented/decremented. This means that when the limit is reached and the user is given a 429 response, the rate limit window is extended. Defaults to 0.
  • 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();.

License

MIT © Wyatt Johnson, Nathan Friedly

Readme

Keywords

none

Package Sidebar

Install

npm i @extensis/rate-limit-redis

Weekly Downloads

12

Version

1.5.2

License

MIT

Unpacked Size

13.3 kB

Total Files

8

Last publish

Collaborators

  • dkchang
  • kim.ma
  • msteelhammer
  • joverland
  • autoextensis
  • cslater-extensis
  • rfattic
  • starjinx
  • cpatzukrussell
  • apriljohnson
  • jblocker
  • srussellextensis
  • lbarr-extensis
  • jhayes
  • bswartz
  • restrin-extensis
  • jbowers-extensis
  • parkerjd85
  • brooksrbrown
  • jmugica
  • glen.thompson
  • mbarron
  • bborig
  • jdiefenbaugh
  • bwilliams_extensis