title: how to maintain persistent session in node js when server restarts?
body: <p>As far as i studied so far from stackoverflow answers regarding making sessions persistent after server restart.</p>
  
  <p><strong>There are 4 possible ways which i considering to do with my mean app.</strong></p>
  
  <ol>
  <li>cookie-Sessions <a href="https://www.npmjs.com/package/cookie-session" rel="noreferrer">https://www.npmjs.com/package/cookie-session</a></li>
  <li>using Json web tokens (JWT) <a href="https://www.npmjs.com/package/jsonwebtoken" rel="noreferrer">https://www.npmjs.com/package/jsonwebtoken</a></li>
  <li>using connect-mongo/connect-redis</li>
  <li>passport.js  </li>
  </ol>
  
  <p>Now my doubt is if i will restart my server in mongo and redis . session will still be there as they are external data stores.
  but how to make my session persistent using JWT and cookie sessions.
  where are these session variables are stored.</p>
  
  <p>In case of passport.js the solution which i came across is to make session persistent is to store session data in connect-mongo/connect-redis.</p>
  
  <p><strong>is there any other way in passport to make sessions persistent?</strong></p>