const jwt = require('jsonwebtoken'); const { jwtSecret } = require('../config/config'); function generateToken(user) { const payload = { username: user.username, email: user.email, }; const options = { expiresIn: '30d', }; return jwt.sign(payload, jwtSecret, options); } exports.generateToken = generateToken;