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