mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-06 23:18:03 +02:00
Merge pull request #332 from bmonty/bmonty/issue-318
move helmet and express.static before sessions for performance
This commit is contained in:
@@ -85,6 +85,16 @@ module.exports = function(db) {
|
||||
app.use(bodyParser.json());
|
||||
app.use(methodOverride());
|
||||
|
||||
// Use helmet to secure Express headers
|
||||
app.use(helmet.xframe());
|
||||
app.use(helmet.xssFilter());
|
||||
app.use(helmet.nosniff());
|
||||
app.use(helmet.ienoopen());
|
||||
app.disable('x-powered-by');
|
||||
|
||||
// Setting the app router and static folder
|
||||
app.use(express.static(path.resolve('./public')));
|
||||
|
||||
// CookieParser should be above session
|
||||
app.use(cookieParser());
|
||||
|
||||
@@ -108,16 +118,6 @@ module.exports = function(db) {
|
||||
// connect flash for flash messages
|
||||
app.use(flash());
|
||||
|
||||
// Use helmet to secure Express headers
|
||||
app.use(helmet.xframe());
|
||||
app.use(helmet.xssFilter());
|
||||
app.use(helmet.nosniff());
|
||||
app.use(helmet.ienoopen());
|
||||
app.disable('x-powered-by');
|
||||
|
||||
// Setting the app router and static folder
|
||||
app.use(express.static(path.resolve('./public')));
|
||||
|
||||
// Globbing routing files
|
||||
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
|
||||
require(path.resolve(routePath))(app);
|
||||
@@ -162,4 +162,4 @@ module.exports = function(db) {
|
||||
|
||||
// Return Express server instance
|
||||
return app;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user