Almost every website involves collecting user input through html forms. Whenever we collect user data, we have to validate it. In Computer Science, data validation is the process of checking whether the data entered is sensible and reasonable.

Consider developing a form for email subscriptions. In this case, we want to check whether the submitted email follows a generic email format like username@randomMail.com. Without validation, malicious users can enter useless values or even perform SQL injections.

In this article, we’ll be performing form data validation using Validator.js - a lightweight NPM package built exactly for this purpose.

#node #javascript #nodejs

Form Data Validation in Node.js with Validator.js
2.95 GEEK