🎁 Validate anything in context
Use the getContext and setContext methods to validate anything in context. 😎
const options = {
convert: true,
getContext(context) {
return context.params.query;
},
setContext(context, newValues) {
Object.assign(context.params.query, newValues);
},
}
const hooks = {
before: {
get: [
validate.form(schema, options)
]
}
}