tunnckoCore / koa-better-ratelimit

: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.
http://j.mp/1stW47C
MIT License
38 stars 6 forks source link

Options is not defined #12

Closed Globik closed 7 years ago

Globik commented 7 years ago
  1. Hi. Trying to test:

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"?

  1. Where can I find koa-better-ratelimit version 3.0?
tunnckoCore commented 7 years ago

duplicate of https://github.com/tunnckoCore/koa-better-ratelimit/issues/11