

It maintains code quality as well, and focuses mainly on business logic. If there is no error, you will receive an empty array which satisfies the first condition in the function.Īs you can see, this module really helps us take care of most of the validations on its own. So if there are any errors, then validationHandler will parse and pass them on to the next middleware.

Let's take a look at a basic user route without any validation module to create a user: /route/user.js /** * The module implements five important API’s:

Introduction to express-validatorĮxpress-validator is a set of express.js middlewares that wraps validator.js validator and sanitizer functions. In this tutorial, you’ll learn how to validate input in an Express.js app using an open source and popular module called express-validator.
