koa-json-router
v1.2.0
Published
Convenience koa-router wrapper for JSON APIs
Downloads
14
Readme
koa-json-router
Simple wrapper for koa-router@next which assumes the resolved value from a handler is the desired return value.
Installation
npm install koa-json-router
Usage
const Koa = require('koa');
const KoaJsonRouter = require('koa-json-router');
const app = new Koa();
const router = new KoaJsonRouter({ prefix: '/api' });
router.get('/foo', async ctx => {
return {
foo: 'bar'
}
});
app.use(router.routes());