

Then, install all the project dependencies by running the following command in the project root: npm install # move into your clone repository cd expressjs-validator To do so, open your terminal in a preferred directory and clone the starter project with the following command: # clone repository git clone To start playing with Express Validator, you will clone a simple Express server to use as a playground. Set Up Your Playground For Express Validator That is, client-side validation is not enough. For example, your servers have no means to know if a malicious user (or virus) disabled front-end validation (e.g., JavaScript) to allow the app to submit bogus data to your server. Mainly speaking, you must care about server-side validation because data coming from other clients (single-page apps, regular web apps, mobile applications, etc.) cannot be trusted. Simply said, Express Validator is an Express middleware library that you can incorporate in your apps for server-side data validation. js, a library that provides validator and sanitizer functions.

Software you need to install to follow this tutorial: If you want to see the complete application developed throughout this article, take a look at this GitHub repository. You will do so by completing a demo application that takes in user input and validates/sanitizes it using

TL DR: In this article you will learn to validate and sanitize data in your Express.jsĪpplications using a set of middleware called express -validator.
