From 76d0649abcafd80509af922503c5544e646bcebb Mon Sep 17 00:00:00 2001 From: Marak Squires Date: Mon, 2 Aug 2010 00:17:00 -0400 Subject: [PATCH] updated readme --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a6ab8c49f..774a6bfbc 100644 --- a/README.md +++ b/README.md @@ -52,15 +52,20 @@ see the [demo](http://github.com/nodejitsu/node-http-proxy/blob/master/demo.js) httpProxy = require('http-proxy'); httpProxy.createServer(function (req, res, proxy) { - // // Put your custom server logic here - // proxy.proxyRequest('localhost', '9000', req, res); }).listen(8000); + http.createServer(function (req, res){ + var proxy = new httpProxy.HttpProxy; + proxy.watch(req, res); + // Put your custom server logic here + proxy.proxyRequest('localhost', 9000, req, res); + }).listen(8001); + http.createServer(function (req, res){ res.writeHead(200, {'Content-Type': 'text/plain'}); - res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2)); + res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2)); res.end(); }).listen(9000);