Working with a Git repository
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 stringHello 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 file to our Git repository. - Check untracked changes in our Git repository with following command:
$git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file...