koa-resource-router icon indicating copy to clipboard operation
koa-resource-router copied to clipboard

seem not support [email protected] async style

Open nothingrealhappen opened this issue 9 years ago • 1 comments

But I found a way to support:

const events = new Resource('events', _.mapValues(eventController, convert.back));
module.exports = convert.compose([router.middleware(), events.middleware()]);

work well!

nothingrealhappen avatar Jun 13 '16 08:06 nothingrealhappen

Or just

var Koa = require('koa')
var convert = require('koa-convert')
var app = new Koa()

// users Resource here

app.use(convert(users.middleware()))

but it won't work for each endpoint's middleware.

I mean these middlewares:

{
  create: [authorization, (ctx, next) => {}, (ctx, next) => {}]
}

tunnckoCore avatar Oct 09 '16 03:10 tunnckoCore