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
1 Answer
Reset to default 7I've had good luck with node-validator: https://github./chriso/node-validator
本文标签: javascriptServer side data validation in ExpressnodejsStack Overflow
版权声明:本文标题:javascript - Server side data validation in Express + node.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741399770a2376595.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论