node.js - How to create a custom asynchronous validator in express-validator? -


i want create custom validator to check duplicate email in database. how can ?

according the docs, add in object defines each validator want use.

app.use(expressvalidator({  customvalidators: {     isarray: function(value) {         return array.isarray(value);     },     gte: function(param, num) {         return param >= num;     }  } })); 

it looks docs not cover asynchronous stuff (e.g. checking db), there pull request several years ago added ability return promise custom validator.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

Ansible warning on jinja2 braces on when -

html - How to custom Bootstrap grid height? -