title: How to save data in expressjs/session NodeJS
body: <p>I have 3 files : app.js, index.js(routes), Users.js(controller)</p>
  
  <p>Once my user is loggedIn (verification done between POST information and DB) i want to save data in a session using expressjs/session.</p>
  
  <p>Here is the declaration of my session in the app.js : </p>
  
  <pre><code>var session = require('express-session');
  
      app.use(session({
          resave: true,
          saveUninitialized: true,
          secret: 'trolololo'
      }));
  </code></pre>
  
  <p>Here are my routes :</p>
  
  <pre><code>router.post('/login', function(req, res, next) {
      Users.login(req, res);
  });
  
  router.get('/getSessionInfos', function(req,res,next){
      console.log(req.session);
  });
  </code></pre>
  
  <p>And here is the controller for the login :</p>
  
  <pre><code>login : function(req, res){
          var formEmail = req.body.email;
          var formPassword = req.body.password;
  
          User.findOne({ where: {email: formEmail} }).then(function(user) {
              if(user){
                if (user.password == formPassword){
                    console.log('User connected');
                    req.session.email = formEmail;
                    req.session.password = formPassword;
                    console.log(req.session);
                    res.status(200).send('User Authentified');
                }else{
                    res.status(401).send('Invalid Password');
                }
            }else{
                res.status(401).send('Username');
            }
          });
      },
  </code></pre>
  
  <p>The Login works I get the 200 status and my console.log in the login function displays a function with my infos. But when i try fetching my session from the /getSessionInfos URL it is empty... Please send help </p>