koajs / csrf

CSRF tokens for koa
MIT License
264 stars 32 forks source link

Importing koa-csrf in node 6 #31

Closed suhas-babyoye closed 7 years ago

suhas-babyoye commented 7 years ago

To be able to import CSRF in node 6.x we have to write like this:

const CSRF = require('koa-csrf').default;

Is this the right way? Also, the README.md example doesn't import CSRF at all(although it is using es6 modules).

kingjerod commented 7 years ago

The example provided is really bad. I'm not sure why they didn't implement it like so: app.use(require('koa-csrf')) or var csrf = require('koa-csrf'); app.use(new csrf({}));

This is what almost all other koa middlewares do. At least update the example to work. =/