From 0248c87ec7c76617af3a3de11791c6f6cbb90aac Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 23 Feb 2011 12:56:50 -0800 Subject: [PATCH] improve hello-world example on website --- doc/index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/index.html b/doc/index.html index 7ae6022187..9b88f44d25 100644 --- a/doc/index.html +++ b/doc/index.html @@ -65,12 +65,13 @@ Server running at http://127.0.0.1:8124/
 var net = require('net');
-net.createServer(function (socket) {
+
+var server = net.createServer(function (socket) {
   socket.write("Echo server\r\n");
-  socket.on("data", function (data) {
-    socket.write(data);
-  });
-}).listen(8124, "127.0.0.1");
+  socket.pipe(socket);
+})
+
+server.listen(8124, "127.0.0.1");