title: What's the correct way to use maxAge with Express.js?
body: <p>I have seen several variations.  Suppose I wish my cookie to expire after one second.  Should I use</p>
  
  <pre><code>app.use(express.session({ secret: 'mysecret',  maxAge: new Date(Date.now() + 1000)}));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>app.use(express.session({ secret: 'mysecret',  maxAge: 1000}));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>app.use(express.session({ secret: 'mysecret',  cookie: {maxAge: new Date(Date.now() + 1000)}}));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>app.use(express.session({ secret: 'mysecret',  cookie: {maxAge: 1000}}));
  </code></pre>
  
  <p>Also suppose I have set my cookie expiring correctly and it has expired. If the user does not restart their browser do they still retain the cookie information until they do so?</p>