Reputation: 62764
My server is comprised of three major components - 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.
Upvotes: 7
Views: 13654
Reputation: 15919
I've had good luck with node-validator: https://github.com/chriso/node-validator
Upvotes: 7