koajs / ratelimit

Rate limiter middleware
MIT License
485 stars 57 forks source link

does it support redis (not ioredis) #65

Closed krishnaTORQUE closed 11 months ago

krishnaTORQUE commented 2 years ago

does it support redis (not ioredis) ?

Error TypeError: Cannot read properties of undefined (reading '1')

Code which does not work

import { createClient } from 'redis';
app.use(
    rateLimit({
      driver: 'redis',
      db: createClient,
      duration: 1000,
      errorMessage: 'You Just Have to Slow Down',
      id: (c) => c.ip,
      headers: {
        remaining: 'Rate-Limit-Remaining',
        reset: 'Rate-Limit-Reset',
        total: 'Rate-Limit-Total',
      },
      max: 99,
      disableHeader: false,
    }),
  );
titanism commented 11 months ago

Please add reproducible working tests to show it does not work (e.g. submit as a PR, thank you)