How do you handle form validation, especially with nested models, in Node.js + Express + Mongoose + Jade

后端 未结 3 676
隐瞒了意图╮
隐瞒了意图╮ 2021-02-02 16:04

How are you handling form validation with Express and Mongoose? Are you using custom methods, some plugin, or the default errors array?

While I could possibly see using

3条回答
  •  离开以前
    2021-02-02 16:59

    I personally use node-validator for checking if all the input fields from the user is correct before even presenting it to Mongoose.

    Node-validator is also nice for creating a list of all errors that then can be presented to the user.

提交回复
热议问题