TypeError: Joi.validate is not a function

I have tried all the solutions offered in the StackOverflow and GitHub but it didn’t work for me because my routes/user.js is structured differently. Also, I am new in Nodejs. I need help to change const result = Joi.validate(req.body, schema); in the routeHelper.js and

const {validateBody, schemas} = require('../helpers/routehelpers');  

in the routes/user.js

====here is my code===
 const Joi = require('joi');
    module.exports = {
      validateBody: (schema) => {
        return (req, res, next) => {
          const result = Joi.validate(req.body, schema);
          if (result.error) {
            return res.status(400).json(result.error);

      if (!req.value) { req.value = {}; }
      req.value['body'] = result.value;

  schemas: {
    authSchema: Joi.object().keys({
      email: Joi.string().email().required(),
      password: Joi.string().required()

const express = require('express'),
      router  = require('express-promise-router')();
const userController = require('../controller/user');
const {validateBody, schemas} = require('../helpers/routehelpers');
const passport = require('passport')
const passportConfig = require('../passport')




module.exports = router;

There’s no such thing as Joi.validate() in the Joi docs. You should write a helper function to do your validation.