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

1.0.1 • Public • Published

Mongo Rate Limit Store

MongoDB store implementation for express-rate-limit package.

This project is fork of the rate-limit-mongo

NPM Version NPM Downloads NPM Install Size NPM Dependency Graph

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 interface. You can check the offical documentation about creating custom stores for express-rate-limit from here.

License

MIT License

Dependents (0)

Package Sidebar

Install

npm i mongo-rate-limit-store

Weekly Downloads

6

Version

1.0.1

License

MIT

Unpacked Size

15.3 kB

Total Files

10

Last publish

Collaborators

  • mertssmnoglu