API request body validation

Hi guys,
I’m wondering how can I validate request body fields (you know username, email, etc.) using node.js.
Currently I’m using dynogels as database odm and using joi for field validation but I don’t want to relay in the last step of the process to validate the data.

Which is the best form in order to validate incoming body requests and fail on lambda integration?
Any useful libraries?

Thank you in advance

I’ve been using validator.ts lately but that only helps if you’re using TypeScript. It looks promising but I really need to clean up the default error messages.

Thanks @buggy, I’m not using TypeScript but as I see I should use Joi.js by creating ‘request body’ schema payloads. Currently I don’t mind the error messages because I’m using lambda integration and our development schedule is very tight. I hope to get rid of that one day :slight_smile: