Saturday, February 29, 2020

Node js Web Server

Start a http server using node js .

Install http-server
npm install http-server -g
Start it 
cd MyApp
http-server
Starting up http-server, serving ./
Available on:
  http://192.138.1.4:8081
  http://169.214.159.112:8081
  http://127.0.0.1:8081
Hit CTRL-C to stop the server
Open the browser and type 
http://192.138.1.4:8081
You can see the index.html file being served .
In the console you will see the following output :
[Sun Mar 01 2020 13:08:41 GMT+0530 (India Standard Time)]  "GET /" "Mozilla/5.0 (Linux; Android 8.0.0; moto x4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.119 Mobile Safari/537.36"
[Sun Mar 01 2020 13:08:42 GMT+0530 (India Standard Time)]  "GET /favicon.ico" "Mozilla/5.0 (Linux; Android 8.0.0; moto x4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.119 Mobile Safari/537.36"
[Sun Mar 01 2020 13:08:42 GMT+0530 (India Standard Time)]  "GET /favicon.ico" Error (404): "Not found"
[Sun Mar 01 2020 13:08:55 GMT+0530 (India Standard Time)]  "GET /FirstApp.html" "Mozilla/5.0 (Linux; Android 8.0.0; moto x4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.119 Mobile Safari/537.36"



No comments:

Post a Comment

ec2-user@ec2 Permission denied