Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
replacing old expressjs 3.x built-in 'compress' middleware with stand…
Browse files Browse the repository at this point in the history
…alone compression middleware
  • Loading branch information
lirantal committed Dec 31, 2014
1 parent 8e5dbbe commit 56bcf17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var fs = require('fs'),
logger = require('./logger'),
bodyParser = require('body-parser'),
session = require('express-session'),
compress = require('compression'),
compression = require('compression'),
methodOverride = require('method-override'),
cookieParser = require('cookie-parser'),
helmet = require('helmet'),
Expand Down Expand Up @@ -48,11 +48,13 @@ module.exports = function(db) {
});

// Should be placed before express.static
app.use(compress({
app.use(compression({
// only compress files for the following content types
filter: function(req, res) {
return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
},
level: 9
// zlib option for compression level
level: 3
}));

// Showing stack errors
Expand Down

0 comments on commit 56bcf17

Please sign in to comment.