title: Sending individual user data back to client from the server [NodeJS]
body: <p>I am making a website where users login through Steam. I am able to get their information (such as profile picture and user name) but I've been struggling with sending it back to the client. The json of the user logging in is held within <code>req.user</code> inside of a get request. How would I go about sending the users info from the server to the client of the user that has just logged in?</p>
  <p>This is my current code -</p>
  <pre><code>// Required to get data from user for sessions
  passport.serializeUser((user, done) =&gt; {
      done(null, user);
  });
  passport.deserializeUser((user, done) =&gt; {
      done(null, user);
  });
  // Initiate Strategy
  passport.use(new SteamStrategy({
      returnURL: 'http://localhost:' + port + '/api/auth/steam/return',
      realm: 'http://localhost:' + port + '/',
      apiKey: 'xxxxxxxxxxxxxxxxxxxx'
      }, function (identifier, profile, done) {
          process.nextTick(function () {
              profile.identifier = identifier;
              return done(null, profile);
          });
      }
  ));
  app.use(session({
      secret: 'LoopTrades',
      saveUninitialized: true,
      resave: false,
      cookie: {
      maxAge: 3600000
      }
  }))
  app.use(passport.initialize());
  app.use(passport.session());
  
  // Routes
  app.get('/', (req, res) =&gt; {
      res.send(req.user);
  });
  app.get('/api/auth/steam', passport.authenticate('steam', {failureRedirect: '/'}), function (req, res) {
      res.redirect('/')
  });
  app.get('/api/auth/steam/return', passport.authenticate('steam', {failureRedirect: '/'}), function (req, res) {
      res.redirect('/pages/deposit.html');
  });
  </code></pre>