How to Validate Data using validator Module in Node.js ? Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The Validator module is popular for validation. Validation is necessary to check whether the data is correct or not, so this module is easy to use and validates data quickly and easily. Feature of validator module: It is easy to get started and easy to use.It is a widely used and popular module for validation.Simple functions for validation like isEmail(), isEmpty(), etc. Installation of validator module: You can visit the link Install validator module. You can install this package by using this command. npm install validator After installing the validator module you can check your validator version in the command prompt using the command. npm version validator After that, you can just create a folder and add a file for example index.js, To run this file you need to run the following command. node index.js Project Structure: Filename: index.js javascript const validator = require('validator') // Check whether given email is valid or not let email = '[email protected]' console.log(validator.isEmail(email)) // true email = 'test@' console.log(validator.isEmail(email)) // false // Check whether string is in lowercase or not let name = 'geeksforgeeks' console.log(validator.isLowercase(name)) // true name = 'GEEKSFORGEEKS' console.log(validator.isLowercase(name)) // false // Check whether string is empty or not let name = '' console.log(validator.isEmpty(name)) // true name = 'geeksforgeeks' console.log(validator.isEmpty(name)) // false // Other functions also available in // this module like isBoolean() // isCurrency(), isDecimal(), isJSON(), // isJWT(), isFloat(), isCreditCard(), etc. Steps to run the program: Make sure you have to install the express and validator modules using the following commands: npm install validator npm install express Run the index.js file using the below command: node index.js Output: So this is how you can use the validator module for validation. There are also other modules available in the market for validation like hapi-joi, express-validator, etc. Comment More infoAdvertise with us G gouravhammad Follow Improve Article Tags : Node.js Node.js-Misc Similar Reads REST API Introduction REST API stands for REpresentational State Transfer API. It is a type of API (Application Programming Interface) that allows communication between different systems over the internet. REST APIs work by sending requests and receiving responses, typically in JSON format, between the client and server. 7 min read NodeJS Interview Questions and Answers NodeJS is one of the most popular runtime environments, known for its efficiency, scalability, and ability to handle asynchronous operations. It is built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. It is extensively used by top companies such as LinkedIn, Net 15+ min read Node.js Tutorial Node.js is a powerful, open-source, and cross-platform JavaScript runtime environment built on Chrome's V8 engine. It allows you to run JavaScript code outside the browser, making it ideal for building scalable server-side and networking applications.JavaScript was mainly used for frontend developme 4 min read JSON Web Token (JWT) A JSON Web Token (JWT) is a standard used to securely transmit information between a client (like a frontend application) and a server (the backend). It is commonly used to verify users' identities, authenticate them, and ensure safe communication between the two. JWTs are mainly used in web apps an 7 min read Express.js Tutorial Express.js is a minimal and flexible Node.js web application framework that provides a list of features for building web and mobile applications easily. It simplifies the development of server-side applications by offering an easy-to-use API for routing, middleware, and HTTP utilities.Built on Node. 4 min read How to Update Node.js and NPM to the Latest Version (2025) Updating Node.js and NPM to the latest version ensures the newest features, performance improvements, and security updates. This article will guide you through the steps to update Node.js and npm to the latest version on various operating systems, including Windows, macOS, and Linux.Different Method 3 min read How to Download and Install Node.js and NPM NodeJS and NPM (Node Package Manager) are essential tools for modern web development. NodeJS is the runtime environment for JavaScript that allows you to run JavaScript outside the browser, while NPM is the package manager that helps manage libraries and code packages in your projects.To run a Node. 3 min read NodeJS Introduction NodeJS is a runtime environment for executing JavaScript outside the browser, built on the V8 JavaScript engine. It enables server-side development, supports asynchronous, event-driven programming, and efficiently handles scalable network applications. NodeJS is single-threaded, utilizing an event l 5 min read Web Server and Its Types A web server is a systemâeither software, hardware, or bothâthat stores, processes, and delivers web content to users over the Internet using the HTTP or HTTPS protocol. When a userâs browser sends a request (like visiting a website), the web server responds by delivering the appropriate resources, 7 min read Top 50+ ExpressJS Interview Questions and Answers ExpressJS is a fast, unopinionated, and minimalist web framework for NodeJS, widely used for building scalable and efficient server-side applications. It simplifies the development of APIs and web applications by providing powerful features like middleware support, routing, and template engines.In t 15+ min read Like