Schema validations using Express Validator how to set custom error message? Schema validations using Express Validator how to set custom error message? express express

Schema validations using Express Validator how to set custom error message?


I think you should put the errorMessage inside the isLength property. Like:

username: {    isLength: {        options: { min: 6 },        errorMessage: 'Username must be at least 6 characters long'    }}