npm install --save koa-inquirer
This package uses Joi to validate the data, so you need to install it.
const Koa = require('koa')
const inquirer = require('koa-inquirer')
const server = new Koa()
server.use(inquirer())
server.listen(3000)
const Joi = require('@hapi/joi')
module.exports = ({ request }) => {
const schema = Joi.object({
name: Joi.string().required()
})
const validated = request.validate(schema) // it will validate request.body, but you can pass other one. ex: validate(schema, request.params)
...
}