app.js cleanup, cache defaults to 1 year for maxAge
This commit is contained in:
11
app.js
11
app.js
@ -52,10 +52,6 @@ mongoose.connection.on('error', function() {
|
|||||||
console.error('MongoDB Connection Error. Make sure MongoDB is running.');
|
console.error('MongoDB Connection Error. Make sure MongoDB is running.');
|
||||||
});
|
});
|
||||||
|
|
||||||
var hour = 3600000;
|
|
||||||
var day = hour * 24;
|
|
||||||
var week = day * 7;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSRF whitelist.
|
* CSRF whitelist.
|
||||||
*/
|
*/
|
||||||
@ -84,10 +80,7 @@ app.use(session({
|
|||||||
resave: true,
|
resave: true,
|
||||||
saveUninitialized: true,
|
saveUninitialized: true,
|
||||||
secret: secrets.sessionSecret,
|
secret: secrets.sessionSecret,
|
||||||
store: new MongoStore({
|
store: new MongoStore({ url: secrets.db, auto_reconnect: true })
|
||||||
url: secrets.db,
|
|
||||||
auto_reconnect: true
|
|
||||||
})
|
|
||||||
}));
|
}));
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
app.use(passport.session());
|
app.use(passport.session());
|
||||||
@ -111,7 +104,7 @@ app.use(function(req, res, next) {
|
|||||||
req.session.returnTo = req.path;
|
req.session.returnTo = req.path;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
app.use(express.static(path.join(__dirname, 'public'), { maxAge: week }));
|
app.use(express.static(path.join(__dirname, 'public'), { maxAge: 31557600000 }));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main routes.
|
* Main routes.
|
||||||
|
Reference in New Issue
Block a user