![]() This will start our development server which will also restart automatically on every change made. Now in your command line, type this: npm run dev 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. Introduction to express-validatorĮxpress-validator is an express middleware that provides us with validation and sanitization functions. To follow along with this article, you should have some basic understanding of express.js. ![]() We will also learn about custom error handling and custom validator. In this post, we will learn about express-validator.
0 Comments
Leave a Reply. |