TypeError: schema.validate is not a function when attempting to validate a JSON request
Use the below approach for validation as joi.validate is no longer supported
const schema = Joi.object({ name: Joi.string().min(6).required(), email: Joi.string().min(6).required().email(), password: Joi.string().min(6).required() })return schema.validate(data)
For anyone still getting "schema.validate is not a function":
When you declare the schema, make sure you declare Joi.object, like so:
const schema = Joi.object({ username: Joi.string().etc})