title: Express.js req.session variable not storing session variables through different routes
body: <p>Cannot acces s<code>req.session variable</code>. I set <code>req.session.username</code> to <code>someVariable</code> but I get
  undefined. Does the following Express setup let me access the req.session variable in every route?</p>
  
  <pre><code>app = express.createServer(
      express.logger(),
      express.cookieParser(),
      express.session({ secret: 'keyboard cat' })
      )
  </code></pre>
  
  <p>Express website seems uses in this way.</p>
  
  <p>EDIT:</p>
  
  <p>Here is some other code I use:</p>
  
  <pre><code>if(result[0] != undefined &amp;&amp; result[0].Password == req.body.user.pass){
      console.log("login successfull");
  
      //Setting in the cookies some variable useful later
      req.session.userAuthenticated = true;
      req.session.username = result[0].Username;
      req.session.projects = result[0].Projects;
  </code></pre>
  
  <p>This is part of the <code>/login</code> route. In this part I check if a user correctly input the password and if he is registered. If I do a <code>console.log(req.session.username)</code> I get the correct username of the user logged in.</p>
  
  <p>In another route, call it <code>/wathever</code> I do a check after a db retrieval like this</p>
  
  <pre><code>if(projects[i].name == projectName &amp;&amp; projects[i].username == req.session.username){
  </code></pre>
  
  <p><code>projectName</code> is something I receive as <code>POST</code> from the user, and it works, it has the correct content, but if I check <code>req.session.username</code> I receive <code>undefined</code>. It seems the session variable is not containing what I put inside in the previous route...</p>
  
  <p>Thanks</p>