Skip to content

Commit c4b7c0d

Browse files
committed
updating demo
1 parent 2f49810 commit c4b7c0d

File tree

2 files changed

+24
-99
lines changed

2 files changed

+24
-99
lines changed

Diff for: demo.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,48 @@
88

99
var vows = require('vows'),
1010
sys = require('sys'),
11-
colors = require('./vendor/colors')
11+
colors = require('colors')
1212
assert = require('assert'),
1313
http = require('http');
1414

1515
var HttpProxy = require('./lib/node-http-proxy').HttpProxy;
1616
var testServers = {};
1717

1818

19-
// regular http server
19+
// ascii art from http://github.com/marak/asciimo
20+
var welcome = '\
21+
# # ##### ##### ##### ##### ##### #### # # # # \n\
22+
# # # # # # # # # # # # # # # # \n\
23+
###### # # # # ##### # # # # # # ## # \n\
24+
# # # # ##### ##### ##### # # ## # \n\
25+
# # # # # # # # # # # # # \n\
26+
# # # # # # # # #### # # # \n';
27+
sys.puts(welcome.rainbow.bold);
28+
29+
// create regular http proxy server
2030
http.createServer(function (req, res){
21-
// Initialize the nodeProxy and start proxying the request
2231
var proxy = new (HttpProxy);
2332
proxy.init(req, res);
24-
// lets proxy the request to another service
25-
proxy.proxyRequest('localhost', '8081', req, res);
26-
27-
}).listen(8080);
28-
sys.puts('started a http server on port 8080'.green)
33+
proxy.proxyRequest('localhost', '9000', req, res);
34+
}).listen(8000);
35+
sys.puts('http proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8000'.yellow);
2936

30-
// http server with latency
37+
// http proxy server with latency
3138
http.createServer(function (req, res){
32-
// Initialize the nodeProxy and start proxying the request
3339
var proxy = new (HttpProxy);
3440
proxy.init(req, res);
35-
36-
// lets proxy the request to another service
3741
setTimeout(function(){
38-
proxy.proxyRequest('localhost', '8090', req, res);
42+
proxy.proxyRequest('localhost', '9000', req, res);
3943
}, 200)
40-
41-
}).listen(8081);
42-
sys.puts('started a http server with latency on port 8081'.green)
43-
44-
44+
}).listen(8001);
45+
sys.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8001 '.yellow + 'with latency'.magenta.underline );
4546

47+
// create regular http server
4648
http.createServer(function (req, res){
4749
res.writeHead(200, {'Content-Type': 'text/plain'});
4850
res.write('foo');
4951
res.end();
50-
}).listen(8090);
51-
sys.puts('started another http server on port 8090'.green)
52-
53-
54-
sys.puts('to test the proxy server, request http://localhost:8080/ in your browser.');
55-
sys.puts('your request will proxy to the server running on port 8081');
52+
}).listen(9000);
53+
sys.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
54+
//sys.puts('to test the proxy server, request http://localhost:8080/ in your browser.');
55+
//sys.puts('your request will proxy to the server running on port 8081');

Diff for: vendor/colors.js

-75
This file was deleted.

0 commit comments

Comments
 (0)