kork
v0.1.0
Published
crude rate limiter - experimental
Downloads
1
Readme
kork
A crude rate limiter for node. A work in progress. Very experimental. Not suitable for production (or anything really).
install
$ npm i kork
wat?
- Checks a global
ts
on each request - If
rate
has not passed since last execution - makes current request wait forrate
ms
usage
// require and set rate in ms
var kork = require('kork')(2500);
// use in express
app.use([path,] kork);
// use in pype stack
pype(null, [klocka, kork, getData, finalhandler])(req, res);
old API
Keeping this for the records
kork.init(rate) // sets new ts and applys rate limit in ms
kork.reset() // sets/overwrites ts
kork.limit() // checks ts
todos
- add tests
- probably needs some kind of global queue
licence
MIT