Roosevelt

Express HTML validator — configuration

Optionally you can pass this module a set of configs:

  • exceptions [Object]: A set of params that can be used to prevent validation in certain scenarios:

    • routes [Array]: An array of routes to exclude from validation. Supports wildcard * syntax. Default: [].
    • header [String]: A custom header that when set will disable the validator on a per request basis. Default: 'Partial'.
    • modelValue [String]: An entry in your data model passed along with a res.render that when set will disable validation on the rendered HTML. Default: '_disableValidator'
  • validatorConfig [Object]: html-validate configuration that determines what errors the validator looks for. The full list of available validator rules can be found here. This configuration can also be set by a .htmlValidate.json file placed in your app root directory.

Default for validatorConfig:

{
  "extends": ["html-validate:standard"]
}

You may also want to override the version of html-validate this module ships with by default, since that module has had a history of updating faster than this one does at times. To do so, set this in your app's package.json:

"overrides": {
  "html-validate": "x.y.z"
}

Where x.y.z is your desired version. After doing so, delete your node_modules folder and package-lock.json then run npm i to install the override.