We have cloned the Sample repository on our local machine. Now we will see how to work with the Git repository:
- Create a Node.js Hello World application that will create an HTTP server and respond to all requests on port 8080 with the string Hello World. Here is the sample code for the Node.js application:
var http = require("http"); http.createServer(function (request, response) { // Send the HTTP header // HTTP Status 200 OK // Content Type is text/plain response.writeHead(200, {'Content-Type': 'text/plain'}); // Send response body as "Hello World" response.end('Hello World\n'); }).listen(8080); // Print message console.log('Server running at http://127.0.0.1:8080/');
- Save the code in main.js and add this ...