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

0.0.2 • Public • Published

Mongo Rate Limit Store

MongoDB store implementation for express-rate-limit package.

This project is fork of the rate-limit-mongo

Install

npm install mongo-rate-limit-store

Getting Started

import { rateLimit } from 'express-rate-limit'
import MongoStore from 'mongo-rate-limit-store'

const limiter = rateLimit({
  store: new MongoStore({
    windowsMs: 15 * 60 * 1000,
    prefix: 'mongo_rl_',
    uri: 'mongodb://localhost:27017',
  }),
  max: 100,
  // should match the windowMs
  windowMs: 15 * 60 * 1000,
})

//  apply to all requests
app.use(limiter)

Implementation

MongoStore class is suitable with the express-rate-limit's Store class. You can check the offical documentation about creating custom stores for express-rate-limit from here.

License

MIT Lisence

Package Sidebar

Install

npm i mongo-rate-limit-store

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

13.2 kB

Total Files

8

Last publish

Collaborators

  • mertssmnoglu