You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using next-joi with next-connect and it works great.
I was wondering if there is a way for the request handler to receive the validated/converted payload.
For example:
const schema = Joi.object({
name: Joi.string().trim(),
number: Joi.number().integer(),
})
req.body = {
name: " dummy ",
number: "5",
}
const handler = nextConnect().post( validate({ body: schema }), async (req, res) => {
const { name, number } = req.body
// Here name and number are the original values
// I would like them to be "dummy" and 5 (name trimmed and number casted to int)
})
Hello,
I am using next-joi with next-connect and it works great.
I was wondering if there is a way for the request handler to receive the validated/converted payload.
For example: