title: How to keep session in expressjs to not expire
body: <p>I have written a simple cms in nodejs using expressjs framework. I used passportjs for authentication using twitter. below is my app.configure:</p>
  
  <pre><code>app.configure(function(){
  //views
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  //parse request bodies
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  // session support
  app.use(express.cookieParser(cfg.cookie_secret));
  app.use(express.session({
    key : 'whynode',
    store : sessionStore,
    cookie: { 
      expires: new Date(Date.now() + 60 * 10000), 
      maxAge: 60*10000
    }
  }));
  app.use(passport.initialize());
  app.use(passport.session());
  //pass user data
  app.use(function(req, res, next) {
    res.locals.req_path = req.path;
    res.locals.user = req.user || false;
    next();
  });
  //get routers
  app.use(app.router);
  //serve asset files
  app.use('/assets', express.static(__dirname + '/public'));
  });
  </code></pre>
  
  <p>I used redis for session store. full app.js code can be viewed here <a href="https://gist.github.com/yalamber/4942790" rel="noreferrer">full app.js</a>
   What I am now experiencing is when I leave app unused for some minutes, session expires and I need to login again. How do we make so that session doesnot timeout for atleast 2-3 hours of inactivity?</p>