Skip to content

Commit 76d0649

Browse files
committed
updated readme
1 parent b622702 commit 76d0649

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,20 @@ see the [demo](http://github.com/nodejitsu/node-http-proxy/blob/master/demo.js)
5252
httpProxy = require('http-proxy');
5353

5454
httpProxy.createServer(function (req, res, proxy) {
55-
//
5655
// Put your custom server logic here
57-
//
5856
proxy.proxyRequest('localhost', '9000', req, res);
5957
}).listen(8000);
6058

59+
http.createServer(function (req, res){
60+
var proxy = new httpProxy.HttpProxy;
61+
proxy.watch(req, res);
62+
// Put your custom server logic here
63+
proxy.proxyRequest('localhost', 9000, req, res);
64+
}).listen(8001);
65+
6166
http.createServer(function (req, res){
6267
res.writeHead(200, {'Content-Type': 'text/plain'});
63-
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
68+
res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2));
6469
res.end();
6570
}).listen(9000);
6671

0 commit comments

Comments
 (0)