switched express-session for cookie-session

This commit is contained in:
bill bittner 2017-10-26 10:48:09 -07:00
parent b5267bcc38
commit 426b605acb
2 changed files with 8 additions and 2 deletions

View file

@ -30,6 +30,7 @@
"body-parser": "^1.17.1",
"config": "^1.26.1",
"connect-multiparty": "^2.0.0",
"cookie-session": "^2.0.0-beta.3",
"express": "^4.15.2",
"express-handlebars": "^3.0.0",
"express-session": "^1.15.5",

View file

@ -14,7 +14,8 @@ const PORT = 3000; // set port
const app = express(); // create an Express application
const db = require('./models'); // require our models for syncing
const passport = require('passport');
const session = require('express-session');
// const session = require('express-session');
const cookieSession = require('cookie-session');
// configure logging
const logLevel = config.get('Logging.LogLevel');
@ -40,7 +41,11 @@ app.use((req, res, next) => { // custom logging middleware to log all incoming
});
// initialize passport
app.use(session({ secret: 'cats', resave: false, saveUninitialized: false }));
app.use(cookieSession({
name : 'session',
keys : ['testcatstest'],
maxAge: 24 * 60 * 60 * 1000, // 24 hours
}));
app.use(passport.initialize());
app.use(passport.session());
passport.serializeUser(serializeSpeechUser); // takes the user id from the db and serializes it