100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Node.js

Introduction to Express

Learn what Express is, why it exists on top of Node's http module, and how to create your first Express server.

Express FundamentalsBeginner8 min readJul 8, 2026
Analogies

Introduction

Express is a minimal and flexible web application framework for Node.js. It sits on top of Node's built-in http module and provides a thin layer of features for building web servers and APIs: routing, middleware, request/response helpers, and template engine integration. Instead of manually parsing URLs and handling every edge case with the raw http module, Express gives you a clean, expressive API to define how your server responds to different requests.

🏏

Cricket analogy: Express is like a well-drilled fielding captain who sits on top of raw athleticism (http), giving structure — set fields, calls, and strategy — so the team doesn't improvise every single delivery from scratch.

Syntax

javascript
const express = require('express');
const app = express();

app.get('/', (req, res) => {
  res.send('Hello, Express!');
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});

Explanation

Calling express() creates an application object, conventionally named app. This object exposes methods like app.get(), app.post(), and others to define routes, plus app.use() to register middleware. app.listen() starts an HTTP server bound to a port and delegates incoming requests to the Express application, which then matches them against registered routes.

🏏

Cricket analogy: Calling express() is like naming a new team franchise; app.get()/app.post() are like registering specific set plays for different match situations, and app.listen() is like the umpire actually starting the match on that ground.

Example

javascript
const express = require('express');
const app = express();

app.get('/about', (req, res) => {
  res.status(200).json({ message: 'About this API', version: '1.0.0' });
});

app.listen(4000, () => {
  console.log('API listening on port 4000');
});

Output

Visiting http://localhost:4000/about in a browser or with a tool like curl returns a JSON response: {"message":"About this API","version":"1.0.0"} with a 200 OK status. The console logs 'API listening on port 4000' once the server starts successfully.

🏏

Cricket analogy: It's like checking a scoreboard app and seeing '{message: About this API, version: 1.0.0}' returned cleanly with a 200 status, confirming the system is live, just as the console logs 'listening on port 4000' at startup.

Key Takeaways

  • Express is a lightweight framework built on top of Node's http module.
  • app.get(), app.post(), etc. define routes for specific HTTP methods and paths.
  • app.listen(port, callback) starts the server and begins accepting connections.
  • Express simplifies routing, middleware, and response handling compared to raw Node.js.

Practice what you learned

Was this page helpful?

Topics covered

#NodeJs#NodeJsExpressStudyNotes#WebDevelopment#IntroductionToExpress#Express#Syntax#Explanation#Example#StudyNotes#SkillVeris