function generateToken(user) {
  const payload = {
    subject: user.id,
    username: user.username
  };
  const secret = "keep it secret, keep it safe";
  const options = {
    expiresIn: "1d"
  };
  return jwt.sign(payload, secret, options);
}
// STEP 2 - token generator function
STEP 2 - token generator function
STEP 2 - token generator function
function generateToken(user) {
  const payload = {
    subject: user.id,
    username: user.username
  };
  const secret = "keep it secret, keep it safe";
  const options = {
    expiresIn: "1d"
  };
  return jwt.sign(payload, secret, options);
}
function generateToken ( user ) { const payload = { subject : user . id , username : user . username } ; const secret = "keep it secret, keep it safe" ; const options = { expiresIn : "1d" } ; return jwt . sign ( payload , secret , options ) ; }
STEP 2 - token generator function
STEP 2 - token generator function