What is Express Js

Express Js is a minimalistic framework based on http module of Node Js. It provides us with the easier creation and implementation of the servers. It simplifies the tasks, that we have to do in order to setup a server using node js. Using Express Js we can easily handle incoming requests of different methods of http protocol like get, post, put, patch, delete etc.

In order to use Express Js in our project, first we have to install the package in our project using the command :-

npm i –save express

Creating a simple server


Why should we use Express Js?

Express Js has a lot of benefits, let’s discuss them one by one :

  1. We can render dynamic content using various templating engines available like ejs, pug etc.
  2. Express Js makes the development easier, as it has many functions which we can use, which otherwise we have to write if we use Node Js without Express Js.
  3. Express Js can handle different types of route with different http methods easily.
  4. We can also use middleware functions, which are executed before any routing request is served. Middlewares have access to req and res object, they also have access to database.

Leave a Reply

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