Skip to content

[question] class transformer for dtos #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
orenmizr opened this issue May 2, 2019 · 1 comment
Open

[question] class transformer for dtos #2

orenmizr opened this issue May 2, 2019 · 1 comment

Comments

@orenmizr
Copy link

orenmizr commented May 2, 2019

hi, isn't making classes via the validation middleware costly - reallocating memory to the req.body object into a class and than again creating a model class for insertion...

isn't there a way to work with the req.body object directly - what is the advantage here ?
thanks.

@babacarcissedia
Copy link

@orenmizr yeah maybe, I personaly use the following approach:

const v = Validator.make(request.body, {
  email: 'required|email',
  password: 'required'
})

If you are familiar with Laravel you'll recognize this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants