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

javascript - Replicate keyboard event with html button -

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

javascript - Web audio api 5.1 surround example not working in firefox -