Introduction to Express.js

01 Min

Express.js is a lightweight web framework for Node.js, designed to simplify building REST APIs, web applications and microservices.

A Brief History

  • 2010 → Express.js was created by TJ Holowaychuk as a minimal framework inspired by Sinatra (a Ruby framework).
  • 2014 → Express.js came under the Node.js Foundation (now part of the OpenJS Foundation), ensuring long-term community support.
  • 2019 onwards → Express became one of the most widely adopted Node.js framework, powering countless APIs and applications.

Its philosophy has always been “unopinionated” - providing only the essentials while leaving architectural decisions to developers.


Overview of Express

Express.js is often described as the de facto standard framework for Node.js. At its core, Express.js is essentially a layer built on top of Node.js’s http module. Express simplifies handling HTTP requests, routing, middleware, and responses compared to using Node’s raw http module directly.

Few features that Express.js provides are -

  • Routing → A powerful way to define endpoints for handling HTTP requests (GET, POST, PUT, DELETE, etc.).
  • Middleware → Functions that process requests before they reach your route handlers, enabling features like logging, authentication, error handling, and more.
  • Template Engines → Support for rendering dynamic HTML using engines like Pug, EJS, or Handlebars.
  • Extensibility → A minimal core that can be extended with thousands of npm packages to suit your project’s needs.

The Express Workflow

Every Express application revolves around the request–response cycle. Middleware and route handlers intercept incoming requests, process them, and generate responses.

Many modern frameworks, such as NestJS, are built on top of Express internally, leveraging its simplicity while adding opinionated structures. Express remains a go-to choice for building REST APIs and backend services. A typical backend architecture might look like this

Client Express.js Business Logic Database / External Services