Updated app.js to move static file routes before use sessions which no need to have session and may gain performance
This commit is contained in:
parent
b221d4ba79
commit
74793b516a
1 changed files with 6 additions and 4 deletions
10
app.js
10
app.js
|
@ -89,6 +89,11 @@ app.use(helmet.hsts({
|
|||
preload: true
|
||||
}));
|
||||
|
||||
// routes without sessions
|
||||
// static files
|
||||
app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime }));
|
||||
app.use('/vendor/', express.static(__dirname + '/bower_components', { maxAge: config.staticcachetime }));
|
||||
|
||||
//session
|
||||
app.use(session({
|
||||
name: config.sessionname,
|
||||
|
@ -145,10 +150,7 @@ passport.deserializeUser(function (id, done) {
|
|||
});
|
||||
});
|
||||
|
||||
//routes
|
||||
//static files
|
||||
app.use('/', express.static(__dirname + '/public'));
|
||||
app.use('/vendor/', express.static(__dirname + '/bower_components'));
|
||||
// routes need sessions
|
||||
//template files
|
||||
app.set('views', __dirname + '/public');
|
||||
//set render engine
|
||||
|
|
Loading…
Reference in a new issue