Before start you need the following two saftwares available on your computer,a>Text Editor b>The Node.js binary installables.
Download latest version of Node.js installable archive file from https://nodejs.org/download/
creating node.js aplication:
step1:Inport Require Module
var http = require("http");
step2:create server
Read request and return response
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 World\n'); }).listen(8081); // Console will print the message console.log('Server running at http://127.0.0.1:8081/');
step3:Testing Request&Response
$ node main.js
Server running at http://127.0.0.1:8081/
Console Output “Hello World”
Congratulations, running success;