koa-req-validator
koa-req-validator copied to clipboard
Return JSON
Hello, there!
Just a doubt: Is it possible to return a JSON instead of a error text message ?
It's a good idea. Do you have any suggestion how the API would look like?
Nice! I think we can start to think on something like this:
const validator = require('koa-req-validator');
const mySchema = require('[json schema location]');
const Router = require('koa-router');
const router = new Router();
router.post('/', validator.default(mySchema, callback(error)));
module.exports = router.routes()