I. What is Express.js?

Express.js is a web framework based on the core Node.js http module and Connect components.

Express helps us easily manage our routing, requests, server-side logic and responses. It also makes our code easier to read, update and extend.

Benefits of Express:

  • Deliver static content
  • Modularize business logic
  • Construct an API
  • Connect to various data sources (with additional plugins)
  • Write less code
  • Validate data (with additional plugins)

II. Install Express as a local dependency

  • Create a folder and a package.json file:
mkdir my-project
cd my-project
npm init -y
  • Install express as a dependency locally:
npm install express
  • Install nodemon (if you haven’t)
npm install -g nodemon