1.0.0 • Published 7 years ago
koa2-joi v1.0.0
koa2-joi
Koa middlevare for request validation using Joi. Have similar to koa-joi interface, but with support for koa2 with async/await
Installation
npm install --save koa2-joi
Usage
const validate = require('koa2-joi');
const schema = {
headers: joi.object().keys({
'my-custom-header': joi.string().required(),
}),
body: joi.object().keys({
email: joi
.string()
.email()
.required(),
password: joi
.string()
.required(),
}),
};
route.post('/login', validate(schema), async ctx => {...})
1.0.0
7 years ago