Created
June 6, 2013 09:45
-
-
Save janl/5720448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proxy = require("http-proxy"); | |
function proxy_couchdb(req, res, proxy) { | |
var random_port = Math.random() >= 0.5 ? | |
4444 : 5555; | |
console.log("Proxy to %d", random_port); | |
proxy.proxyRequest(req, res, { | |
host: '127.0.0.1', | |
port: random_port | |
}); | |
} | |
proxy.createServer(proxy_couchdb).listen(3333); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment