惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
DataBreaches.Net
B
Blog RSS Feed
博客园_首页
The GitHub Blog
The GitHub Blog
I
InfoQ
L
LangChain Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
美团技术团队
腾讯CDC
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
🚀 Introduction to Express.js – the framework that changed...
Ramanand Tha · 2026-05-26 · via DEV Community

Express.js made backend development in JavaScript ridiculously simple. Before Express, building APIs in Node felt like assembling IKEA furniture without the manual 😅.


🧠 The JavaScript Revolution

There was a time when JavaScript lived only inside browsers.

Frontend? JavaScript.
Backend? Mostly PHP, Java, Python, Ruby, or .NET.

Then came Node.js in 2009 and everything changed.

Suddenly, developers could write JavaScript on both:

  • 🖥️ Client side (browser)
  • 🌐 Server side (backend)

Yes, this was a massive shift.

Teams no longer needed separate frontend and backend language expertise. One language could handle:

  • UI rendering
  • API development
  • Real-time chat apps
  • Streaming
  • File handling
  • Even CLI tools

And this is where Express.js entered like a Bollywood hero in slow motion 🎬.


⚡ Introducing Express

Express.js is a lightweight web framework built on top of Node.js.

Think of Node.js as the raw engine of a car 🚗.

Express gives you:

  • Steering wheel
  • Dashboard
  • Brakes
  • Air conditioning
  • And sane defaults 😄

Without Express, building APIs in pure Node means manually handling:

  • Routing
  • Headers
  • Request parsing
  • Response formatting
  • Middleware chaining

Express simplifies all of that.


📦 Installing Express

Prerequisites

  • Node.js v18+
  • Basic JavaScript knowledge (Watch any quick 30 minutes tutorial on YT)
  • npm installed
  • ☕ 2 cups of coffee

🛠️ Your First Express Server

mkdir express-demo
cd express-demo

npm init -y
npm install express

Enter fullscreen mode Exit fullscreen mode

Now create server.js.

// Node v20 + Express 4

const express = require('express');

const app = express();

// Route handler
app.get('/', (req, res) => {
  res.send('Hello from Express 🚀');
});

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

Enter fullscreen mode Exit fullscreen mode

Run it:

node server.js

Enter fullscreen mode Exit fullscreen mode

Open browser:

http://localhost:3000

Enter fullscreen mode Exit fullscreen mode

And boom 💥 — backend server ready in less than 10 lines.


🌍 Server-side vs Client-side Applications

This is where many beginners get confused.

Let’s simplify it.

🖥️ Client-side Applications

Client-side apps run in the browser.

Examples:

  • React
  • Angular
  • Vue

Responsibilities:

  • Rendering UI
  • Handling clicks
  • Animations
  • Calling APIs

🌐 Server-side Applications

Server-side apps run on servers.

Responsibilities:

  • Database operations
  • Authentication
  • Business logic
  • API responses
  • Security

📊 How They Talk To Each Other

client-server-communication

This separation is the backbone of modern web apps.


📜 A Brief History of Express

Express was created by TJ Holowaychuk around 2010.

Back then, Node.js was still young.

Developers loved Node’s speed, but building servers directly with Node’s http module was painful.

Here’s how raw Node looked:

// Pure Node.js HTTP server 😵

const http = require('http');

const server = http.createServer((req, res) => {
  if (req.url === '/') {
    res.writeHead(200, {
      'Content-Type': 'text/plain'
    });

    res.end('Hello World');
  }
});

server.listen(3000);

Enter fullscreen mode Exit fullscreen mode

Not terrible… until your app grows to 50 routes and middleware chains.

Express solved that elegantly.


⚔️ Node.js vs Traditional Web Servers

Before Node.js, most web servers worked like this:

🧵 Traditional Web Servers (Apache, PHP, Java)

Request Flow

traditional web server flow

Every request often created:

  • New thread
  • More memory usage
  • Context switching overhead

Works fine… until traffic explodes 🚦.


⚡ Node.js Architecture

Request Flow

nodejs server

Node uses:

  • Single-threaded event loop
  • Non-blocking I/O
  • Async processing

This is why Node became insanely popular for:

  • Real-time apps
  • APIs
  • Streaming
  • Chat systems
  • Notification services

☕ Caffeine Scale

Topic Complexity
Basic Express routes
Middleware ☕☕
Event loop internals ☕☕☕☕

🌱 The Node Ecosystem

One of Node’s biggest strengths is the ecosystem.

The package manager npm exploded in popularity because developers could share reusable libraries instantly.

Today there are millions of packages.

Some famous ones:

Package Purpose
express Web framework
mongoose MongoDB ORM
socket.io Real-time communication
dotenv Environment variables
jsonwebtoken JWT authentication
nodemon Auto restart during development

📄 Licensing

Express is open-source software released under the MIT License.

That means:

✅ Free to use
✅ Free to modify
✅ Free for commercial projects

This openness helped Express spread rapidly across startups and enterprises alike.

Even huge companies adopted it because there were no painful licensing restrictions.


❌ Common Beginner Mistakes

(Try these fixes you face issue running your first express backend)

1️⃣ Forgetting Middleware

// ❌ req.body will be undefined

app.post('/login', (req, res) => {
  console.log(req.body);
});

Enter fullscreen mode Exit fullscreen mode

✅ Correct Version

// Express 4.18+

app.use(express.json());

app.post('/login', (req, res) => {
  console.log(req.body);
  res.send('Body parsed correctly');
});

Enter fullscreen mode Exit fullscreen mode


2️⃣ Blocking the Event Loop

// ❌ Very dangerous for performance

while(true) {
  // Infinite blocking loop 💥
}

Enter fullscreen mode Exit fullscreen mode

Node works best when operations stay async.


📊 Express vs Traditional Backend Frameworks

Feature Express.js Traditional Java Frameworks
Language JavaScript Java
Performance Excellent for I/O Excellent for CPU-heavy work
Learning Curve Easy Moderate
Boilerplate Minimal Often verbose
Real-time Support Excellent Good
Startup Speed Fast Slower

🎯 Conclusion

Express.js became popular because it made backend development:

  • Simpler
  • Faster
  • More readable
  • More JavaScript-friendly

Key takeaways:

  • 🚀 Express simplified Node.js web development
  • 🌐 Node introduced a non-blocking server model
  • 📦 npm created one of the biggest developer ecosystems ever
  • ⚡ Express is ideal for APIs and real-time applications
  • 🔓 Open-source licensing accelerated adoption worldwide

And honestly? Once you build your first Express API, going back to raw HTTP servers feels like manually washing clothes after buying a washing machine 😄.


🔥 What’s Next?

In the next part, we’ll dive deeper in:

  • Using the Terminal
  • Using Editor
  • Using NPM (Node Package Manager)
  • Event-Driven Programming
  • Routing
  • Serving static resources

💬 Your Turn

What was your first backend framework?

PHP? Django? Spring Boot? Express?

And have you ever crashed a production server accidentally? 😅


📢 Call To Action

If this helped you understand Express better:

  • ⭐ Share it with another developer
  • 🔁 Bookmark for revision
  • 🚀 Try building a tiny REST API today
  • 👨‍💻 Follow for more deep-dive backend content