next() Packaged Middleware

    express-rate-limit-ioredis-store
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    Express Rate Limit IORedis store

    A redis store implementation to be used alongside ioredis for the Express Rate Limit middleware. Since the existing redis store is not natively typed and seemed to be using the legacy store version of the Express Rate Limit, I decided to implement a new store for my personal projects. There is a disavantage to rate-limit-redis, in which this store only works with the IORedis client.

    Installation

    With npm:

    $ npm install --save express-rate-limit-ioredis-store

    With yarn:

    $ yarn add express-rate-limit-ioredis-store

    Usage

    const ExpressRateLimit = require("express-rate-limit");
    const RedisStore = require("express-rate-limit-ioredis-store");
    
    const limiter = ExpressRateLimit({
      store: new RedisStore({
        // check Options
      }),
      max: 100,
      windowMs: 60000,
    });
    
    app.use(limiter);

    Or with ES modules

    import ExpressRateLimit from 'express-rate-limit';
    import RedisStore from 'express-rate-limit-ioredis-store';
    
    const limiter = ExpressRateLimit({
      store: new RedisStore({
        // check Options
      }),
      max: 100,
      windowMs: 60000,
    });
    
    app.use(limiter);

    Options

    • globalPrefix: string (optional) - the prefix that will be added to all the redis keys used by this lib. Default value is express-rate-limit-store-.
    • client: The ioredis Client to be used by the store.

    Licence

    MIT (c) 2022 Gustavo Soviersovski

    Install

    npm i express-rate-limit-ioredis-store

    DownloadsWeekly Downloads

    3

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    40.9 kB

    Total Files

    49

    Last publish

    Collaborators

    • gustavo.soviersovski