Manage Validations with Node Input Validator in Node JS

Standard Way to Manage Validations in Node JS with Node Input Validator Package Node JS - Education Funda As per standard code in node js we should prefer manage validations in separate directory and files it means we can create separate directory such as validations and inside it we can create index.js file which is common file and manage separate validation for each module such as userValidatoin.js, postValidation.js etc. Something like this we can manage directory structure. Let's go deep into code now:- validations/index.js file: const validator = require ( "node-input-validator" ) const ResponseMiddleware = require ( "../middlewares/ResponseMiddleware" ) const fn = require ( '../helpers/functions' ) module . exports = { //common function to send validation response validate : ( v , res , next , req = null ) => { console . log ( "ValidatorsIndex => validate" ) if ( v . check (). then ( function ( ma...