var session = require(“express-session”); var MongoStore = require(‘connect-mongo’)(session);
var app = express();
app.set('views’, path.join(__dirname, ‘views’)); app.set('view engine’, ‘ejs’);
app.use(logger(‘dev’)); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, ‘public’)));
app.use(session({ secret:settings.cookieSecret, key:settings.db, cookie:{maxAge:100060602430}, store:new MongoStore({ db:settings.db, host:settings.host, port:settings.port }), resave: true, saveUninitialized: true }));