title: NodeJS express-session req.session is undefined
body: <p>I am working on a simple login system, but it seems like the session is not saved </p>
  
  <p>i have made a simple code for testing, can anyone tell me what is wrong with it ?
  i am running login and after that i am running the is_logged but i am never logged and both sessions are undefined</p>
  
  <pre><code>var port = process.env.PORT || 8080;
  var express = require('express');
  var app = express();
  
  
  var cookieParser = require('cookie-parser');
  var session = require('express-session');
  
  
  
  app.use(cookieParser());
  app.use(session({
      secret: "fd34s@!@dfa453f3DF#$D&amp;W", 
      resave: false, 
      saveUninitialized: true, 
      cookie: { secure: true }
  }));
  
  
  
   app.post('/test_login', function(req, res){
  
      req.session.users_schema = 1;
      req.session.user_doc = 2;
  
      res.json({"first": req.session.users_schema, "second": req.session.user_doc});
  });
   app.post('/test_is_loggin', function(req, res){
  
      if( !req.session.users_schema || !req.session.user_doc ) { 
  
          console.log("no");
          res.json({"first": 1, "second": 1});
      }
      else {
  
          console.log("no2");
          res.json({"first": req.session.users_schema, "second": req.session.user_doc});
      }
  
   });
  
  
  app.listen(port);
  console.log('Listening on port ' + port);
  </code></pre>