NodeJS - Quick Start- Web development
A node.js web application contains the following three components: Import required modules : The "require" directive is utilized to load a Node.js module. Engender server : You have to establish a server that will listen to the client's request akin to Apache HTTP Server. Read request and return replication : The server engendered in an earlier step will read the HTTP request made by the client which can be a browser or a console and return the replication. Example 1: index.js var http = require( "http" ); http.createServer( function (request, response) { // Send the HTTP header // HTTP Status: 200 : OK // Content Type: application/json response.writeHead( 200 , { "Content-Type" : "application/json" }); var otherArray = [ "Java" , "Kotlin" ]; var otherObject = { item1: "Angular" , item2: "React Native" }; var json = JSON.stringify({ anObject: otherObject,