NodeJs

Introduction to NodeJs Express Framework

Introduction to nodejs Express framework why use node js framework tutorial

In the previous lesson, we have learned about npm and seen that how we can include any package in our project. Now we will discuss the difference between framework and library. We will also introduce NodeJs Express Framework and we will see why we use the express framework.

Introduction to NodeJs Express Framework

What is the Framework?

The framework is the collection code or libraries that provide multiple services. So a framework is a set of the guideline and it prevents inappropriate use. The framework has some rules and boundaries, so developer always develop their application by following these rules. So the framework takes all the common stuff that we do have in every application, all the setup work, all the basic things that every application needs and then make the package of all these things. Then we can use this package later on other application so we don’t need to spend the time to work on the very basic stuff every single time we make a new application.

How is a framework different from the library?

The library is simply the collection of codes like some function, document object model, etc. All these things packed together and then can be used over and over on other projects easily. So the freedom to call particular code or method whenever you want is the library. While the framework is slightly different, it’s an inversion of control. So framework calls your code then further your code call can call to a library. In the library, we make a call to the library, while in the framework, the framework calls to our code.

what is javasceipt framework. how it is different from library

 

What is NodeJs Express Framework?

Express is a web development framework for nodeJS, it provides a robust set of features for web and mobile applications. It is fast, flexible and provides a thin layer of fundamental web application features and allows us to set up middlewares which are used to respond to HTTP Requests. Express also defines a routing table which helps to perform the particular task based on HTTP Method and URL. With express, we can render an HTML page dynamically.

 

Introduction to ExpressJs framework, installation

 

So express is used to create a simple web server which helps to respond to the HTTP request.

Why use Express Framework?

Express is the world most popular node web development framework. It has most downloads on npm, it has most people contributing to it on GitHub. This is one of the most widely used the nodeJs framework which is always the great reason for us to use it.

Express is the light-weight framework which means it has lot more blanks, a lot more frequently across the page where you are expected to go in and fill in your own code more often. So express is light-weight and the most powerful javascript framework.

Express is fast unopinionated nodejs framework, unopinionated framework means flexible. It will let us do things that we want.

How to install Express Framework?

We can install express framework like the way we install other nodejs frameworks. So if we want to install Express then we first need to create the project folder where we want to install the Express and then run the following command:

Npm install express

We can also run the following command to but it doesn’t make any difference at all in the functionality of express.

Npm install express –save

You can notice in the following Command prompt screen that the express framework is added to our project.

installation of NodeJs Express framework

 

Conclusion:

In this knowledge bit, we have learned about the framework and the difference between framework and library. Then we have introduced express framework and seen that why we should use this framework. We have also learned that how we can include NodeJs express framework into our project. Now in the next knowledge bit, we will see that how we can create our first application using the express framework.

Click to comment

Most Popular

To Top