// utils/generateToken.js
const jwt = require('jsonwebtoken');

/**
 * @param {String} id  MongoDB _id of the user
 * @returns {String}   Signed JWT, expires in 30 days
 */
module.exports = (id) => {
  return jwt.sign({ id }, process.env.JWT_SECRET, {
    expiresIn: '30d'
  });
};