In this tutorial, We are going to learn how to create a simple Hello World Node Js Application. We already have a basic information of Node.JS from our previous session. In this session, we will see how can we create a simple Hello World Node.JS Application.
Before getting started with Hello World Node.Js application we need to know about few major component related to a basic Node.JS application.
1- require directive – require directive is used to include required Node.JS module.
2-Create Server – The next thing we need to do is to create a server that will listen to the incoming request from the client.
3-Process Request and Returned Response – After the server is created in the previous step, this server is used to process incoming request from the server and returned the response.
Creating Hello World Node.JS Application:
Step 1- Create a folder in your System Drive with the Name NodeJSDemo (or any name you want).
Step 3- Open Node.JS command prompt.
Step 4- Navigate to the directory location and start the server using the below command.
Where HelloWorld.js is your file name.
Step 5- Now open your browser and hit the following URL.
You will get a response something like that.
This is the output what we have returned from Create Server.
Hope this tutorial will help you in learning Node.Js as a beginner. I will be happy to receive your feedback, comments and suggestions.