diff --git a/lib/app.js b/lib/app.js index 1c01c4ca45..f8b554154c 100644 --- a/lib/app.js +++ b/lib/app.js @@ -1,6 +1,7 @@ 'use strict'; const express = require('express'); +const compression = require('compression'); const favicon = require('serve-favicon'); const cookieParser = require('cookie-parser'); const routes = require('./routes'); @@ -26,6 +27,7 @@ module.exports = function(config) { config.preHook(app); } + app.use(compression()); app.use(cookieParser()); app.use(express.json({ strict: false })); app.use(unleashSession(config)); diff --git a/package.json b/package.json index 5e7e2519c5..3ddb4ddeb0 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "dependencies": { "async": "^2.1.5", "commander": "^2.15.1", + "compression": "^1.7.3", "cookie-parser": "^1.4.3", "cookie-session": "^2.0.0-beta.3", "db-migrate": "^0.11.1", diff --git a/yarn.lock b/yarn.lock index ad1f259436..e5775736da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1335,6 +1335,24 @@ component-emitter@^1.2.0, component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" +compressible@~2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.14.tgz#326c5f507fbb055f54116782b969a81b67a29da7" + dependencies: + mime-db ">= 1.34.0 < 2" + +compression@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.3.tgz#27e0e176aaf260f7f2c2813c3e440adb9f1993db" + dependencies: + accepts "~1.3.5" + bytes "3.0.0" + compressible "~2.0.14" + debug "2.6.9" + on-headers "~1.0.1" + safe-buffer "5.1.2" + vary "~1.1.2" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -4111,6 +4129,10 @@ micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.1" +"mime-db@>= 1.34.0 < 2": + version "1.36.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.36.0.tgz#5020478db3c7fe93aad7bbcc4dcf869c43363397" + mime-db@~1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" @@ -5480,7 +5502,7 @@ safe-buffer@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"