Node start – create a server listening port.

var http = require(“http”);
function onRequest(request, response) {
nsole. log(” function start “);
response. WriteHead (200, {” content-type “:” text/plain “});
response. Wirte (” hello “);
the response. The end ();
}
http.createServer(onRequest).listen(8888);
console.log(“Server has startsed”)
Get Node’s HTTP module first.
var http = require(“http”);
Write the handler function. onRequest
Create the server and listen on port 8888
http.createServer(onRequest).listen(8888);

Read More: