Rate limiter for Node.js backed by Redis.
v2.0.0 - API CHANGE - Change
remaining to include current call instead of decreasing it. Decreasing caused an off-by-one problem and caller could not distinguish between last legit call and a rejected call.
$ npm install ratelimiter
Example Connect middleware implementation limiting against a
var id = requser_id;var limit = id: id db: db ;limit;
remaining- number of calls left in current
durationwithout decreasing current
reset- time in milliseconds until the end of current
id- the identifier to limit against (typically a user id)
db- redis connection instance
max- max requests within
duration- of limit in milliseconds