Browse files

add gzip compression

  • Loading branch information...
1 parent 91cb957 commit 4f41294a4421608bc6175e728509a6df6a432bb1 @madhums committed Dec 31, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 config/express.js
View
8 config/express.js
@@ -11,6 +11,14 @@ var express = require('express')
module.exports = function (app, config, passport) {
app.set('showStackError', true)
+ // should be placed before express.static
+ app.use(express.compress({
+ filter: function (req, res) {
+ console.log(res.getHeader('Content-Type'));
+ return /json|text|javascript|css/.test(res.getHeader('Content-Type'));
+ },
+ level: 9
+ }))
app.use(express.static(config.root + '/public'))
app.use(express.logger('dev'))

0 comments on commit 4f41294

Please sign in to comment.