middy-middleware-class-validator
A middy middleware that returns errors as http errors, compatible with http-errors.
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install middy-middleware-class-validator --save
Documentation
There is additional documentation.
Usage
// When using decorators, don't forget to import this in the very first line of code // Define a validator for the body via class-validator // This is your AWS handler // Let's "middyfy" our handler, then we will be able to attach middlewares to it .useClassValidatorMiddleware // The class validator throws validation errors from http-errors which are compatible with // the error handler middlewares for middy .useJSONErrorHandlerMiddleware