Last Word
promise based redis request limiter
npm install last-word --save
Usage example
const ms = ;const lastWord = limit: 3 // number of request before blocked timeLimit: // time in milliseconds when number of requests are cleared blockTime: // block time when client: client // instance of the redis client message: 'Limit Reached' // Your custom error message Error: YourNewAwesomeError // Your custom error type; app;
Options that Last Word accepts
Name | Description | Default |
---|---|---|
client(required) | instance of the redis client | null |
limit | Number of request before blocked | 10 |
timeLimit | time in milliseconds when number of requests are cleared | ms('30s') |
blockTime | How long request key will be blocked, after reaching the limit | ms('5m') |
message | Custom error message | Request limit reached |
Error | Custom error type | Error |
Licence
MIT
Name
name is taken from one of the spells of dota 2 silencer hero