What is express.Js?
Express.js is a template framework developed for node.js. Express.js simplifies our work due to its structure and useful approach. It provides us convenience in GET, POST, DELETE operations and Routing operations and many other operations. Express is flexible and concise, which means it doesn’t have a large collection of unnecessary libraries and packages, or it doesn’t tell you how to build your application.
The first thing you’ll need to do is create a package.json file (within your project directory/folder) using the following command:
package name: (hello)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
The package name, version, entry point, and license fields all have default values that you can easily override by providing your values. However, if you want to keep the default values you can simply use the following command instead:
Executing the command above will generate the following package.json file in your project directory:
Now you can install Express using the following command:
Installing Express in your project directory will automatically update your package.json file.
Creating a Server With Express: