diff options
author | Cheng-Han, Wu | 2016-04-20 18:14:28 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-04-20 18:14:28 +0800 |
commit | 74793b516a885f21ecc1143892b6c64b916b404f (patch) | |
tree | 66cca62d8ba13ac167341f19aac0fda325f4cbef | |
parent | b221d4ba79d3ca40ace205ba8461019f7282db53 (diff) |
Updated app.js to move static file routes before use sessions which no need to have session and may gain performance
Diffstat (limited to '')
-rw-r--r-- | app.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 |