Welcome aboard! We are happy you are here and wish you good net-raft!
// place into main.js
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello Node.js\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
// then type "node main.js" in node.js command prompt
// you will see the following result : Server running at http://127.0.0.1:8081/
// then open http://127.0.0.1:8081/ in any browser
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K