:rocket: Smart and easy request rate limiter for your APIs built on `koa`, using `koa-ip-filter`. Support custom stores, custom ID, custom error messages and custom headers.
const Koa=require('koa2');
const limiter=require('./index.js');
const app=new Koa();
app.use(limiter({
id:function(){return '0.0.0.0'},
duration:1000*20,
max:2,
throw:true
}))
app.use(ctx=>{
ctx.body="hello world";
});
app.listen(5000);
console.log('Server started at port 5000');
But
ReferenceError: options is not defined
at betterRatelimit (/home/globik/koa-better-ratelimit/index.js:33:8)
at dispatch (/home/globik/koa-better-ratelimit/node_modules/koa-compose/index.js:44:32)
at next (/home/globik/koa-better-ratelimit/node_modules/koa-compose/index.js:45:18)
at createGenerator (/home/globik/koa-better-ratelimit/node_modules/koa-convert/index.js:24:16)
at createGenerator.next ()
at Object. (/home/globik/koa-better-ratelimit/node_modules/koa-ip-filter/index.js:77:20)
at Generator.next ()
at onFulfilled (/home/globik/koa-better-ratelimit/node_modules/co/index.js:65:19)
at /home/globik/koa-better-ratelimit/node_modules/co/index.js:54:5
at Object.co (/home/globik/koa-better-ratelimit/node_modules/co/index.js:50:10)
What for the "options"?
Where can I find koa-better-ratelimit version 3.0?
const Koa=require('koa2'); const limiter=require('./index.js'); const app=new Koa(); app.use(limiter({ id:function(){return '0.0.0.0'}, duration:1000*20, max:2, throw:true })) app.use(ctx=>{ ctx.body="hello world"; }); app.listen(5000); console.log('Server started at port 5000');
But ReferenceError: options is not defined at betterRatelimit (/home/globik/koa-better-ratelimit/index.js:33:8) at dispatch (/home/globik/koa-better-ratelimit/node_modules/koa-compose/index.js:44:32) at next (/home/globik/koa-better-ratelimit/node_modules/koa-compose/index.js:45:18) at createGenerator (/home/globik/koa-better-ratelimit/node_modules/koa-convert/index.js:24:16) at createGenerator.next ()
at Object. (/home/globik/koa-better-ratelimit/node_modules/koa-ip-filter/index.js:77:20)
at Generator.next ()
at onFulfilled (/home/globik/koa-better-ratelimit/node_modules/co/index.js:65:19)
at /home/globik/koa-better-ratelimit/node_modules/co/index.js:54:5
at Object.co (/home/globik/koa-better-ratelimit/node_modules/co/index.js:50:10)
What for the "options"?