How does assert (req.assert) work in nodejs
Accepted answer refers to what is now the Legacy API hence broken links.
Check out the documentation for Sanitization and the available sanitizing tools. You can make custom validators in there.
It's defined in Express's dependency express-validator. Check here: https://github.com/ctavan/express-validator/blob/master/lib/express_validator.js
which depends on validator: https://github.com/chriso/validator.js