I'm trying to validate if the input is an integer or a float within a certain range using express-validator. I've tried:
check(
'rating',
'Rating must be a number between 0 and 5'
).isNumeric({ min: 0, max: 5 }),
but the min and max values don't actually work. I tried putting in numbers above 5 and they don't throw an error.
The code below works, it won't allow numbers outside of the min and max limits:
check(
'rating',
'Rating must be a number between 0 and 5'
).isInt({ min: 0, max: 5 })
but only for integer numbers, not for decimals, and the input needs to be either a decimal or an integer number between 0 and 5.
Is there a way to do this?
