3.0.0 • Published 6 months ago

@routup/rate-limit-redis v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@routup/rate-limit-redis

npm version main codecov Known Vulnerabilities Conventional Commits

This is a redis adapter for the rate-limit plugin.

Table of Contents

Installation

npm install @routup/rate-limit-redis --save

Documentation

To read the docs, visit https://routup.net

Usage

import { createServer } from 'node:http';
import {
    createNodeDispatcher,
    Router
} from 'routup';
import { rateLimit } from '@routup/rate-limit';
import { RedisStore } from '@routup/rate-limit-redis';

const router = new Router();

// Apply the rate limiting middleware to API calls only
router.use('/api', rateLimit({
    // 15 minutes
    windowMs: 15 * 60 * 1000,

    // Limit each IP to 100 requests
    // per `window` (here, per 15 minutes)
    max: 100,

    // connection string or ioredis instance 
    // can be passed optional as argument 
    store: new RedisStore(),
}));

const server = createServer(createNodeDispatcher(router));
server.listen(3000);

License

Made with 💚

Published under MIT License.

This library is heavily inspired by express-rate-limit-redis.

1.0.2

8 months ago

3.0.0

6 months ago

2.0.0-alpha.3

8 months ago

2.2.0

6 months ago

2.0.0-alpha.0

8 months ago

2.1.0

7 months ago

2.0.0

8 months ago

1.0.1

12 months ago

1.0.0

1 year ago

1.0.0-alpha.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago