DEV Community

Discussion on: Sequalize model validation or express-validator?

Collapse
 
igeligel profile image
Kevin Peters

Always validate and catch errors as early as possible.

There are two reasons. One is performance but which is not as important as I think.

The other reason is separation. If you validate early you can easily exchange the ORM in this case. It gives you a more dynamic workflow for the future which is good.

Collapse
 
adrian110288 profile image
Adrian

Thanks Kevin for the answer. I am of the same mindset that I should validate user input before anything else. Would you then say that I should have just a basic validators in the models or should I just not utilize Sequelize validation at all? My only concern is that I would be duplicating validation rules across models and in the route handler. What would be your solution? Thanks

Collapse
 
gperezlz profile image
Gastón Perez

Did you solve your question? How could he solve it? I find myself in the same situation.