{get} /lesson/v1
{get} /lesson/v2
{get} /lesson/v3
{get} /lesson/v1/channel
{get} /lesson/v2/channel
{get} /lesson/v3/channel
{
"message": "channelIndex is required, query must contain at least one of [index, sequence]",
"code": "ValidationError",
"asdf": "this is error handler in app"
}
{
"message": [
"channelIndex is required",
"query must contain at least one of [index, sequence]"
],
"code": "ValidationError",
"asdf": "this is error handler in app"
}
{
"message": "channelIndex is required, query must contain at least one of [index, sequence]",
"code": "ValidationError",
"asdf": "this is error handler in api"
}
router.post("/v1", validate(postLesson, { convert: false }), (req, res) => {
return res.json(req.body);
});
router.post("/v2", validate(postLesson), (req, res) => {
return res.json(req.body);
});
// ------- postLesson
exports.postLesson = {
body: commonJoi.keys({
subject: Joi.string().required(),
count: Joi.number(),
}),
};
// body
{
"subject": "aaa",
"index": "123123",
"count": "123" // v1 - 에러 발생, v2 - 에러 X
}