Browse Source

Use a less common port in docs

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
3104662bab
  1. 10
      doc/api.markdown
  2. 10
      doc/index.html

10
doc/api.markdown

@ -12,15 +12,15 @@ World':
http.createServer(function (request, response) { http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'}); response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n'); response.end('Hello World\n');
}).listen(8000); }).listen(8124);
sys.puts('Server running at http://127.0.0.1:8000/'); sys.puts('Server running at http://127.0.0.1:8124/');
To run the server, put the code into a file called `example.js` and execute To run the server, put the code into a file called `example.js` and execute
it with the node program it with the node program
> node example.js > node example.js
Server running at http://127.0.0.1:8000/ Server running at http://127.0.0.1:8124/
All of the examples in the documentation can be run similarly. All of the examples in the documentation can be run similarly.
@ -2052,7 +2052,7 @@ A reference to the `http.Client` that this response belongs to.
This class is used to create a TCP or UNIX server. This class is used to create a TCP or UNIX server.
Here is an example of a echo server which listens for connections Here is an example of a echo server which listens for connections
on port 7000: on port 8124:
var net = require('net'); var net = require('net');
var server = net.createServer(function (stream) { var server = net.createServer(function (stream) {
@ -2068,7 +2068,7 @@ on port 7000:
stream.end(); stream.end();
}); });
}); });
server.listen(7000, 'localhost'); server.listen(8124, 'localhost');
To listen on the socket `'/tmp/echo.sock'`, the last line would just be To listen on the socket `'/tmp/echo.sock'`, the last line would just be
changed to changed to

10
doc/index.html

@ -49,8 +49,8 @@ http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'}); res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n'); res.end('Hello World\n');
}, 2000); }, 2000);
}).listen(8000); }).listen(8124);
sys.puts('Server running at http://127.0.0.1:8000/');</pre> sys.puts('Server running at http://127.0.0.1:8124/');</pre>
</pre> </pre>
<p> <p>
@ -60,10 +60,10 @@ sys.puts('Server running at http://127.0.0.1:8000/');</pre>
</p> </p>
<pre class="sh_none"> <pre class="sh_none">
% node example.js % node example.js
Server running at http://127.0.0.1:8000/</pre> Server running at http://127.0.0.1:8124/</pre>
<p> <p>
Here is an example of a simple TCP server which listens on port 7000 Here is an example of a simple TCP server which listens on port 8124
and echos whatever you send it: and echos whatever you send it:
</p> </p>
@ -82,7 +82,7 @@ var server = tcp.createServer(function (socket) {
socket.end(); socket.end();
}); });
}); });
server.listen(7000, "localhost");</pre> server.listen(8124);</pre>
<p> <p>
See the <a href="api.html">API documentation</a> for more See the <a href="api.html">API documentation</a> for more

Loading…
Cancel
Save