Last active
January 2, 2016 11:39
-
-
Save DarrylDias/8297843 to your computer and use it in GitHub Desktop.
Hello World that displays console log on every new client's connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function(request,response) { | |
response.writeHead(200, {'Content-Type':'text/plain'}); | |
response.end("Hello World!\n"); // "Hello World!" will be displayed to the client's browser | |
console.log("New page request!\n"); // message will be displayed with every new request | |
}).listen(8000); //Node web server port. Edit it to your preferd port. | |
console.log("Node web server running at http://127.0.0.1:8000"); | |
console.log("CTRL + C to stop the Node web server"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment