console.log('Server running at http://127.0.0.1:1337/');</pre>
<p>To run the server, put the code into a file
<code>example.js</code> and execute it with the
<code>node</code> program from the command line:</p>
<preclass="sh_none">
% node example.js
Server running at http://127.0.0.1:1337/</pre>
<p>Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:</p>
<pre>
var net = require('net');
var server = net.createServer(function (socket) {
socket.write('Echo server\r\n');
socket.pipe(socket);
});
server.listen(1337, '127.0.0.1');</pre>
<!-- <p>Ready to dig in? <a href="">Download the latest version</a> of node.js or learn how other organizations are <a href="">using the technology</a>.</p> -->
<p>Copyright <ahref="http://joyent.com/">Joyent, Inc</a>, Node.js is a <ahref="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <ahref="https://raw.github.com/joyent/node/__VERSION__/LICENSE">license</a>.</p>