Validation
Like Persistence. Enso makes no assumption as to which solution suits the needs of your project.
However we do provide a few suggestions. We belive the following; is an elegant way of leveraging middleware to compose elegant
, readable
endpoints.
@httpPost('/:uuid', validate(SomeRequest))
async someEndpoint (ctx: Router.IRouterContext) {
const validated = ctx.data
}
Learn how to do this with the recipe below.
- Validation with class-validator