Skip to content

Commit

Permalink
[minor] Fix syntax in examples/
Browse files Browse the repository at this point in the history
  • Loading branch information
olauzon committed May 17, 2011
1 parent e6c52d4 commit ff82946
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions examples/basic-proxy-https.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ https.createServer(opts, function (req, res) {
// Create the proxy server listening on port 443.
//
httpProxy.createServer(443, 'localhost', {
https: opts,
https: opts
}).listen(8080);

util.puts('https proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8000'.yellow);
util.puts('https server '.blue + 'started '.green.bold + 'on port '.blue + '8080 '.yellow);
util.puts('https server '.blue + 'started '.green.bold + 'on port '.blue + '8080 '.yellow);
2 changes: 1 addition & 1 deletion examples/basic-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

var util = require('util'),
colors = require('colors')
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');

Expand Down
8 changes: 4 additions & 4 deletions examples/forward-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
*/

var util = require('util'),
colors = require('colors')
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');

//
// Setup proxy server with forwarding
//
Expand All @@ -52,12 +52,12 @@ http.createServer(function (req, res) {
// Target Http Forwarding Server
//
http.createServer(function (req, res) {
util.puts('Receiving forward for: ' + req.url)
util.puts('Receiving forward for: ' + req.url);
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('request successfully forwarded to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
res.end();
}).listen(9001);

util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8003 '.yellow + 'with forward proxy'.magenta.underline)
util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8003 '.yellow + 'with forward proxy'.magenta.underline);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
util.puts('http forward server '.blue + 'started '.green.bold + 'on port '.blue + '9001 '.yellow);
12 changes: 6 additions & 6 deletions examples/latent-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
*/

var util = require('util'),
colors = require('colors')
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');

//
// Http Proxy Server with Latency
//
httpProxy.createServer(function (req, res, proxy) {
var buffer = proxy.buffer(req);
setTimeout(function() {
proxy.proxyRequest(req, res, {
port: 9000,
host: 'localhost',
port: 9000,
host: 'localhost',
buffer: buffer
});
}, 200)
}, 200);
}).listen(8002);

//
Expand All @@ -53,4 +53,4 @@ http.createServer(function (req, res) {
}).listen(9000);

util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8002 '.yellow + 'with latency'.magenta.underline);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
6 changes: 3 additions & 3 deletions examples/proxy-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
*/

var util = require('util'),
colors = require('colors')
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');

//
// Http Proxy Server with Proxy Table
//
Expand All @@ -47,5 +47,5 @@ http.createServer(function (req, res) {
res.end();
}).listen(9000);

util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8001 '.yellow + 'with proxy table'.magenta.underline)
util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8001 '.yellow + 'with proxy table'.magenta.underline);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
10 changes: 5 additions & 5 deletions examples/standalone-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
*/

var util = require('util'),
colors = require('colors')
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');

//
// Http Server with proxyRequest Handler and Latency
//
Expand All @@ -37,8 +37,8 @@ http.createServer(function (req, res) {
var buffer = proxy.buffer(req);
setTimeout(function() {
proxy.proxyRequest(req, res, {
port: 9000,
host: 'localhost',
port: 9000,
host: 'localhost',
buffer: buffer
});
}, 200);
Expand All @@ -54,4 +54,4 @@ http.createServer(function (req, res) {
}).listen(9000);

util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '8004 '.yellow + 'with proxyRequest handler'.cyan.underline + ' and latency'.magenta);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
6 changes: 3 additions & 3 deletions examples/web-socket-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var sys = require('sys'),

try {
var utils = require('socket.io/lib/socket.io/utils'),
io = require('socket.io');
io = require('socket.io');
}
catch (ex) {
console.error('Socket.io is required for this example:');
Expand All @@ -55,11 +55,11 @@ server.listen(8080);
var socket = io.listen(server);
socket.on('connection', function (client) {
sys.debug('Got websocket connection');

client.on('message', function (msg) {
sys.debug('Got message from client: ' + msg);
});

socket.broadcast('from server');
});

Expand Down

0 comments on commit ff82946

Please sign in to comment.