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
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');
});
Run it:
node server.js
Open browser:
http://localhost:3000
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
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);
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
Every request often created:
- New thread
- More memory usage
- Context switching overhead
Works fineβ¦ until traffic explodes π¦.
β‘ Node.js Architecture
Request Flow
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);
});
β Correct Version
// Express 4.18+
app.use(express.json());
app.post('/login', (req, res) => {
console.log(req.body);
res.send('Body parsed correctly');
});
2οΈβ£ Blocking the Event Loop
// β Very dangerous for performance
while(true) {
// Infinite blocking loop π₯
}
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



Top comments (0)