Skip to content

Commit

Permalink
added initial compression of everything so we can start testing and s…
Browse files Browse the repository at this point in the history
…ee if there are any issues
  • Loading branch information
jasoncalabrese committed Mar 14, 2015
1 parent 3162422 commit b7fc6b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"body-parser": "^1.4.3",
"bower": "^1.3.8",
"browserify-express": "^0.1.4",
"compression": "^1.4.2",
"errorhandler": "^1.1.1",
"event-stream": "~3.1.5",
"express": "^4.6.1",
Expand Down
12 changes: 9 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var store = require('./lib/storage')(env, function() {


var express = require('express');
var compression = require('compression');

///////////////////////////////////////////////////
// api and json object variables
Expand All @@ -66,9 +67,14 @@ var appInfo = software.name + ' ' + software.version;
app.set('title', appInfo);
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.

//if (env.api_secret) {
// console.log("API_SECRET", env.api_secret);
//}
app.use(compression({filter: shouldCompress}));

function shouldCompress(req, res) {
//TODO: return false here if we find a condition where we don't want to compress
// fallback to standard filter function
return compression.filter(req, res);
}

app.use('/api/v1', api);

// pebble data
Expand Down

0 comments on commit b7fc6b9

Please sign in to comment.