text: const express = require('express');
  const {check} = require('express-validator');
  
  const Auth = require('../controllers/auth');
  const Password = require('../controllers/password');
  const validate = require('../middlewares/validate');
  
  const router = express.Router();
  
  router.post('/register', [
      check('email').isEmail().withMessage('Enter a valid email address'),
      check('password').not().isEmpty().isLength({min: 6}).withMessage('Must be at least 6 chars long'),
      check('confirmPassword').not().isEmpty().withMessage('Your confirm password is required'),
      check('name').not().isEmpty().withMessage('Your name is required')
  ], validate, Auth.register);
  
  router.post("/login", [
      check('email').isEmail().withMessage('Enter a valid email address'),
      check('password').not().isEmpty(),
  ], validate, Auth.login);
  
  
  //EMAIL Verification
  router.get('/verify/:token', Auth.verify);
  router.post('/resend', Auth.resendToken);
  
  //Password RESET
  router.post('/recover', [
      check('email').isEmail().withMessage('Enter a valid email address'),
  ], validate, Password.recover);
  
  router.get('/reset/:token', Password.reset);
  
  router.post('/reset/:token', [
      check('password').not().isEmpty().isLength({min: 6}).withMessage('Must be at least 6 chars long'),
      check('confirmPassword', 'Passwords do not match').custom((value, {req}) => (value === req.body.password)),
  ], validate, Password.resetPassword);
  
  router.post('/googlelogin',Auth.googlelogin);
  router.post('/googlesignup',Auth.googlesignup);
  
  
  module.exports = router;