text: const jwt = require("jsonwebtoken");
  
  module.exports = (req, res, next) => {
    try {
      const token = req.headers.authorization.split(" ")[1];
      const decoded = jwt.verify(token, process.env.JWT_PW);
      req.userData = decoded;
      next();
    } catch (error) {
      return res.status(401).json({
        message: "Your token has expired. Please log in again."
      });
    }
  };