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

Ansible warning on jinja2 braces on when -

Parsing a protocol message from Go by Java -

node.js - Node js - Trying to send POST request, but it is not loading javascript content -