admin管理员组

文章数量:1289878

My server is prised of three major ponents - node.js + express + mongojs. Right now I am looking for a way to plug in server side validation of the client input. Mongoose offers it through its Schema definitions, however, I would like the validation to be independent of the particular DB layer.

Ideally, I am looking for something supporting declarative validation rules (again, like the mongoose schemas), but without any coupling with mongo.

Any ideas?

P.S.

I am mentioning Express, because my intention is to plug the validation layer as an Express middleware. This should work, shouldn't it?

P.P.S.

An extra bonus, if the same javascript code can be utilized on the client side as well.

My server is prised of three major ponents - node.js + express + mongojs. Right now I am looking for a way to plug in server side validation of the client input. Mongoose offers it through its Schema definitions, however, I would like the validation to be independent of the particular DB layer.

Ideally, I am looking for something supporting declarative validation rules (again, like the mongoose schemas), but without any coupling with mongo.

Any ideas?

P.S.

I am mentioning Express, because my intention is to plug the validation layer as an Express middleware. This should work, shouldn't it?

P.P.S.

An extra bonus, if the same javascript code can be utilized on the client side as well.

Share Improve this question edited Oct 4, 2012 at 21:50 josh3736 145k34 gold badges226 silver badges270 bronze badges asked Oct 4, 2012 at 21:41 markmark 62.9k96 gold badges342 silver badges669 bronze badges 1
  • When downvoting, it is considered good manners to explain the reason. – mark Commented Jul 13, 2016 at 11:35
Add a ment  | 

1 Answer 1

Reset to default 7

I've had good luck with node-validator: https://github./chriso/node-validator

本文标签: javascriptServer side data validation in ExpressnodejsStack Overflow