I want to validate the entity data separately from making a POST request and display errors in the form. I'm using class-transformer. What's the best way to achieve this with Nest?
I want to validate the entity data separately from making a POST request and display errors in the form. I'm using class-transformer. What's the best way to achieve this with Nest?
Sounds exactly like what the ValidationPipe is for. You decorate your DTO with class-validator decorators, set the @Body() type in your endpoint, and bind the pipe and viola, the request gets validated when sent to the server and returns errors that you can parse if any exist