filestore for sessions

This commit is contained in:
azivner 2017-10-15 17:07:34 -04:00
parent f2d2dad3d8
commit 597a9063e5
3 changed files with 8 additions and 2 deletions

View file

@ -6,6 +6,7 @@ const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const helmet = require('helmet');
const session = require('express-session');
const FileStore = require('session-file-store')(session);
const appRoute = require('./routes/app');
const loginRoute = require('./routes/login');
@ -48,7 +49,11 @@ app.use(session({
// path: "/",
httpOnly: true,
maxAge: 1800000
}
},
store: new FileStore({
ttl: 3600,
path: '../sessions'
})
}));
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));

View file

@ -19,6 +19,7 @@
"morgan": "~1.9.0",
"scrypt": "^6.0.3",
"serve-favicon": "~2.4.5",
"session-file-store": "^1.1.2",
"sqlite": "^2.8.0"
}
}

View file

@ -19,7 +19,7 @@ function randomString(length, chars) {
}
function nowTimestamp() {
return Date.now() / 1000;
return Math.floor(Date.now() / 1000);
}
function toBase64(plainText) {