You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
Hi. I've found express-form very useful, but only for express applications. For plain objects I can use https://www.npmjs.org/package/node-validator, but it didn't use validator package, which isn't nice. I think express-form can be easily refactored into 2 packages. First one is about data validation (with chaining and all cool stuff), and the second one is about express middleware specific. Here are some thoughts:
Object validation
// create validator bundlevarv=validator(validator.property('name').trim().toString().requred(),// alias for form.field// other routines);// perform data validationv.run(objectToValidate,function(err,data){// err - validation errors (same as in the middleware) or null// data - sanitized objectToValidate});
Express middleware
form factory for middleware will just delegate all validation specific logic to the validation module.
Hi. I've found
express-formvery useful, but only for express applications. For plain objects I can use https://www.npmjs.org/package/node-validator, but it didn't usevalidatorpackage, which isn't nice. I thinkexpress-formcan be easily refactored into 2 packages. First one is about data validation (with chaining and all cool stuff), and the second one is about express middleware specific. Here are some thoughts:Object validation
Express middleware
formfactory for middleware will just delegate all validation specific logic to the validation module.Any thoughts?