How do I save express request data as a usable variable in my express app?

Viewed 11

I have an express app using passport for authentication. Passport ultimately routes to the dashboard, and displays the users email problem on the welcome screen. However, I need to access that email string in my app.js to do some other processes. I can't figure out how to store that as a variable and make it accessible in my app.js. Apologies for the beginner style articulation of my question.

router.get('/dashboard', ensureAuthenticated, (req, res) =>
  res.render('dashboard', {
    user: req.user.email,
    layout: 'dashboard',
  })
);
0 Answers
Related