Now, hop over the terminal in your working directory, and write the following command: npm init -y Now let’s move on to the fun part! We will be learning about express-validator by creating validation for user signup. Just keep this in mind “the data received from client-side shouldn’t be blindly trusted.” So, add a validation check. This is just one example where validation can be useful. But the developers of this robust app had implemented validation so that the app would respond with some error message if the user input was invalid. What if the user gave us an invalid format of the phone number or just random string? Well in that case, our app might malfunction. To make a phone call we obviously need the phone number from the user. That feature rich app offers the user to make phone calls to any phone number in the world, let’s say. Let’s say we have a robust app with multiple rich features. You might be thinking “why do we need validation at all?” That’s a good question. Validator.js is a library which helps us to validate several different kinds of data. Actually, Express validator is built on top of validator.js. Node.js Express Server Side Form Validation With Custom Error Messages Using express-validator AJAX Introduction to express-validatorĮxpress-validator is an express middleware that provides us with validation and sanitization functions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |