Best place to handle data validation with mongoose and express

Viewed 6350

Maybe there is not a definitive answer here but I would like to know where to handle data validation when dealing with express.js and mongoose. Which of the following is the best practice (I currently use a combination and it's starting to feel very clumsy):

  1. the Model (mongoose)
  2. the Controller / Route (express)

Some older posts I have read are:

but conflicting answers just add to the confusion. Maybe it simply isn't clear cut, in which case is one a better option?

2 Answers
Related