Open tamilvjm opened 4 years ago
you can also import the simple validation like minlenght, required... also from the model schema of mongoose For custom validation, you can use this way:
router.post(
'/',
body({
content: {
...content,
required: true,
minlength: 2,
validate: (value) => ({ valid: value === 'flag', message: 'Content value is not flag' }),
}
}),
create
)
how to make conditional validation using bodymen? for example only validate if some flag is enabled.
Is there any such feature in it?