Merge pull request #2687 from shindakun/expressgzip

Add gzip compression, can be enabled/disabled in config.js
This commit is contained in:
Hannah Wolfe 2014-05-06 08:24:54 +01:00
commit 8a4e0e27f2
2 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,7 @@
var crypto = require('crypto'),
express = require('express'),
hbs = require('express-hbs'),
compress = require('compression'),
fs = require('fs'),
uuid = require('node-uuid'),
Polyglot = require('node-polyglot'),
@ -64,7 +65,7 @@ function initDbHashAndFirstRun() {
return dbHash;
}).then(doFirstRun);
}
return dbHash;
});
}
@ -216,6 +217,11 @@ function init(server) {
// return the correct mime type for woff filess
express['static'].mime.define({'application/font-woff': ['woff']});
// enabled gzip compression by default
if (config().server.compress !== false) {
server.use(compress());
}
// ## View engine
// set the view engine
server.set('view engine', 'hbs');

View File

@ -35,6 +35,7 @@
"bookshelf": "0.6.8",
"busboy": "0.0.12",
"colors": "0.6.2",
"compression": "^1.0.2",
"connect-slashes": "1.2.0",
"downsize": "0.0.5",
"express": "3.4.6",