. Some more HTML follows, and then the original requested URL gets written out, mainly as a demonstration.
The original call to createServer returns a server object, and then we call that object's listen method, which you can see in the line second from last. This call says to listen on address 127.0.0.1 via port 8124. (Normally web servers use port 80; I used the same address in the example that came with node for this sample.)
And the final line writes a quick message to the console—this information doesn't get written to the web browser, but rather the console in which this program is running.
To run the program, you go to the directory where you saved it, and type (assuming the code is saved in the file called example.js, and that node is available in the path):
node example.js
Here's the full session running in the Linux command prompt window:
This is the web server itself running. Let's try it out. I opened up a web browser and put in the following URL: http://127.0.0.1:8124/hello/there/everyone
Here's what I saw in my browser:
Notice that I put in the same address and port as specified in the code. When I right-click in the browser and click View Source, here's what I see:
Greetings
/hello/there/everyone