title: How to clear req.session on clearing browser cookies in node js?
body: <p>I am using <code>"express": "~4.14.0"</code> with <code>express-session</code> for saving username. Once  the user is logged in, I will save the user name in <code>req.session.authorizedUser = username</code> to display it in the application header.</p>
  
  <p>When either the browser history is cleared or the browser is closed, I want to clear the session.</p>
  
  <p>Please suggest me if there is any way to clear the session when doing any of these two operations. I have tried setting the <code>maxAge</code> option for session cookies, as shown below, but it doesn't reflects good:</p>
  
  <pre><code>app.use(session({
      secret: "key test",
      resave: false,
      saveUninitialized: true,
      cookie: { secure: !true, path: '/', httpOnly: true, maxAge: null}
  }));
  </code></pre>