title: Express.js + Google Chrome extension : is session storage possible?
body: <p>I'm working on a Google Chrome extension with a popup, in which I load a page from a node.js + express.js server. The page I load changes depending on the status of the <code>req.session.user</code> in this way:</p>
  
  <pre><code>app.get('/', function(req, res){
      if(req.session.user){
          res.render(__dirname + '/pages/base.jade', {});
      }
      else{
          res.render(__dirname + '/pages/login_register.jade', {});
      }
  });
  </code></pre>
  
  <p>If <code>req.session.user</code> is null I send a page in which the user can do the login or register. If he/she does a login, this is what happens in the server:</p>
  
  <pre><code>app.post('/login', function(req, res){
      var user = {};
      user.username = req.body.username;
      user.password = req.body.password;
      checkLogin(user, function(foundUser){
          //login correct
          console.log("login!");
          req.session.user = foundUser;
          res.render(__dirname + '/pages/base.jade', {
          });
      });
  });
  </code></pre>
  
  <p>So if the user logs in correctly <code>req.session.user</code> should be set with the credentials of the current user. The problem is that once I log in and then close the popup of the Chrome extension, whenever I reopen it I still receive the login page.</p>
  
  <p>My question is: does the popup supports session storage in the express.js server? If yes, then there is something wrong with my code, can anyone point out what am I doing wrong? Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>This is how I setup the server:</p>
  
  <pre><code>var app = express.createServer(
      express.logger(),
      express.cookieParser(),
      express.session({ secret: 'keyboard cat' })
  );
  
  app.use(express.cookieParser());
  app.use(express.session({ secret: "keyboard cat" }));
  app.set('view engine', 'ejs');
  app.set("view options", { layout: true });
  </code></pre>
  
  <p>I might be doing something redundant here, since I still don't have a deep understanding of how that works.</p>