A software engineer trying to build stuff and helping people in open source. I like beers, sunny beaches and JavaScript but I also fiddle around with a lot of other languages and tools.
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.
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
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.
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
Did you solve your question? How could he solve it? I find myself in the same situation.