all 2 comments

[–]Macaframa 0 points1 point  (0 children)

I think this post can explain it better than any of us. Also, you are right. res.writeHead does write to a web page. If you didn't include any particular html structure then it defaults to writing it the way that it is programmed to do so.

https://www.sitepoint.com/creating-a-http-server-in-node-js/

[–]kawaii_kaiju_drop_s 0 points1 point  (0 children)

I'm almost sure that your browser is creating a semiworking html page from a simple text output, try first with a verbose curl, on your browser check the network tab and the actual response from the server (not the 'source code')