Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jbuck/hackto
Browse files Browse the repository at this point in the history
  • Loading branch information
mjschranz committed Apr 14, 2012
2 parents 559f8cb + 6a98ca5 commit fec11e3
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions server.js
@@ -1,10 +1,27 @@
var express = require('express'),
app = express.createServer();
app = express.createServer(),
httpProxy = require('http-proxy');

app.use(express.static(__dirname + '/public'));

app.listen(8888, '127.0.0.1', function() {
httpProxy.createServer(function(req, res, proxy) {
req.headers.host = 'multicolorengine.tineye.com';

if (req.url.indexOf('hackdays_flickr') != -1) {
proxy.proxyRequest(req, res, {
host: 'multicolorengine.tineye.com',
port: 80
});
} else {
proxy.proxyRequest(req, res, {
host: 'localhost',
port: 8989
});
}
}).listen(8888);

app.listen(8989, '127.0.0.1', function() {
var addy = app.address();
console.log('Server started on http://' + addy.address + ':' + addy.port);
console.log('Server started on http://localhost:8888');
console.log('Press Ctrl+C to stop');
});

0 comments on commit fec11e3

Please sign in to comment.