Skip to content

Commit

Permalink
Merge pull request #175 from Kibibit/feature-add-gzip
Browse files Browse the repository at this point in the history
[FEATURE] add compression middleware for express.js
  • Loading branch information
thatkookooguy authored Jul 25, 2016
2 parents 402d3ff + decd8ec commit f29b807
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"velocity": "~1.2.3",
"ngclipboard": "~1.1.1",
"ng-device-detector": "~3.0.1",
"viewerjs": "fengyuanchen/viewerjs#~0.4.0"
"viewerjs": "fengyuanchen/viewerjs#~0.4.0",
"amplitude": "^2.0.0"
},
"resolutions": {
"angular": "1.5.8"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.14.2",
"colors": "~1.1.2",
"compression": "^1.6.2",
"express": "^4.13.4",
"helmet": "^2.1.1",
"mime-types": "^2.1.11",
Expand Down
6 changes: 6 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// CALL THE PACKAGES --------------------
var express = require('express'), // call express
compression = require('compression'),
helmet = require('helmet'),
config = require('./config'),
path = require('path'),
Expand All @@ -19,6 +20,11 @@ var console = require('./app/models/consoleService')
// read more at https://github.com/helmetjs/helmet
app.use(helmet());

// compress all requests
app.use(compression({
threshold: 0
}));

colors.enabled = true; //enable colors even through piping.

// create application/json parser
Expand Down

0 comments on commit f29b807

Please sign in to comment.