Allow different ports for http_simple.js
authorRyan Dahl <ry@tinyclouds.org>
Mon, 3 May 2010 00:26:18 +0000 (17:26 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Mon, 3 May 2010 00:26:18 +0000 (17:26 -0700)
benchmark/http_simple.js

index e709f2d72428dc0bbb5f77199944c1e1060cdf33..54958d169b6abe9e6ad29d62939353d59e4ae0e7 100644 (file)
@@ -1,5 +1,7 @@
 path = require("path");
 
+port = parseInt(process.env.PORT || 8000);
+
 var puts = require("sys").puts;
 
 var old = (process.argv[2] == 'old');
@@ -61,4 +63,6 @@ http.createServer(function (req, res) {
   } else {
     res.end(body, 'ascii');
   }
-}).listen(8000);
+}).listen(port);
+
+puts('Listening at http://127.0.0.1:'+port+'/');