diff --git a/examples/hello-world/config.json b/examples/hello-world/config.json new file mode 100644 index 0000000..f584548 --- /dev/null +++ b/examples/hello-world/config.json @@ -0,0 +1 @@ +Hello World!!! \ No newline at end of file diff --git a/examples/hello-world/index.js b/examples/hello-world/index.js index 9d4e33e..2522f97 100755 --- a/examples/hello-world/index.js +++ b/examples/hello-world/index.js @@ -1,10 +1,10 @@ var http = require("http"), +fs = require("fs"), +path = require("path"), port = 1337; -console.log(process.argv); - -console.log("started HTTP server on port %d", 1337); +console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port); http.createServer(function(req, res) { - res.end("Hello World!!"); + fs.createReadStream(path.join(process.cwd(), "message.txt")).pipe(res); }).listen(port); \ No newline at end of file diff --git a/examples/hello-world/message.txt b/examples/hello-world/message.txt new file mode 100644 index 0000000..bc7774a --- /dev/null +++ b/examples/hello-world/message.txt @@ -0,0 +1 @@ +hello world! \ No newline at end of file