Skip to content

Instantly share code, notes, and snippets.

@nisargap
Created January 4, 2017 05:22
Show Gist options
  • Save nisargap/565e64318d97ccb2e888844ed5b21af0 to your computer and use it in GitHub Desktop.
Save nisargap/565e64318d97ccb2e888844ed5b21af0 to your computer and use it in GitHub Desktop.
// Nasty line to refactor:
// app.use(require('express-session')({ secret: 'keyboard cat', resave: false, saveUninitialized: false }));
// No one can read that
// expressSession library
var expressSession = require('express-session');
// sessionOptions object
var sessionOptions = {
secret: "keyboard cat",
resave: false,
saveUninitialized: true
}
var sessionInstance = expressSession(sessionOptions);
// Use the session instance
app.use(sessionInstance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment