Skip to content

A datastore for express-rate-limit that uses the token bucket algorithm

License

Notifications You must be signed in to change notification settings

JGLTechnologies/precise-memory-rate-limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Precise Memory Rate Limit

Precise memory store for express-rate-limit.

Npm version

Install

$ npm install --save precise-memory-rate-limit

Example

const rateLimit = require("express-rate-limit")
const MemoryStore = require("precise-memory-rate-limit")

const max = 10

const limiter = rateLimit({
    store: new MemoryStore(max),
    windowMs: 15 * 60 * 1000,
    max: max // Make sure this is the same as the max passed into the MemoryStore constructor
})

app.use(limiter)

precise-memory-ratelimit does not currently support using a middleware for the max