Hello world application using nodejs and express

In this tutorial, we will learn how to display hello world in our application using nodejs and express, We will know about nodejs. Nodejs is open source framework it used the javascript server and it is run on different os like as Windows, Linux, Unix, and Mac, etc. so first we will check the node is intall or no in our system, if no in our system, then after we will goto follow below Url and install node.js.

How to install and download nodejs and npm for window os

Let’s go and follow below step for how to display hello world in our application using nodejs and exress.js.

Step 1: Create Application Directory.

First, we will open the command prompt and create the application directory. for this you can follow below command.

Step 2: Create a application using npm init

The “npm init” command through we can create a new package.json file in our application directory. when we build new app that time we use this command. Node.js will need to have a package.json file because includes the application related packages and applications data.

Here below command help to initialization our application.

Step 3: Install Express Package

Expess.js is free and open-source framework and it’s web application framework for Node.js. we can manage routes, create restful api, handle the request and response and also create MVC structure using the express.js. Npm stands for node package manager. npm help to installing node packages and manage the types of dependencies.

Here below command help to install express package.

Step 4: Create New File and Save

First, we will take a new file and paste follow below code in our file and save as app.js.

Step 5: Run Our Application

Finally, We will run our application using the follow below command.

Leave a Reply

Your email address will not be published. Required fields are marked *