How to use the express-session/session/store.prototype function in express-session

To help you get started, we’ve selected a few express-session examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylonide / pylon / plugins-server / connect.session.file / session-ext.js View on Github external
var expires = (typeof sess.cookie.expires === 'string')
                            ? new Date(sess.cookie.expires)
                            : sess.cookie.expires;
                        if (!expires || new Date < expires) {
                            // session ok
                        } else {
                            self.destroy(file);
                        }
                    });
                });
            });
        }, self.reapInterval);
    }
};

FileStore.prototype.__proto__ = Store.prototype;

FileStore.prototype.get = function(sid, fn){
  var self = this;
  var exists = fs.exists || path.exists;
  exists(self.basePath + "/" + sid, function(exists) {
      if (exists) {
          fs.readFile(self.basePath + "/" + sid, function(err, data) {
              if (err) {
                  fn && fn(err);
              }
              else {
                  var sess;
                  try {
                      sess = JSON.parse(data);
                  } catch(e) {
                      console.warn("Error '" + e + "' reading session: " + sid, data);