What is Express
Express is a small framework on top of Node's http module that makes routing and middleware easy.
In this page:
What is Express
Express wraps Node's HTTP server with a friendly API for routes, middleware and templating. It is unopinionated and the base of many other frameworks. An Express app is a function you pass to http.createServer or run with app.listen.
Note:
Express itself is tiny; its power comes from middleware.
Example: What is Express
$ node -e "console.log(typeof require('express'))"
function
$ # A minimal Express app
const express = require("express");
const app = express();
app.get("/", (req, res) => res.send("Hello Express"));
app.listen(3000);
⚠️ Run this in your own terminal or Node.js environment.
Related Topics
Common Mistakes
- Thinking Express replaces Node
- Adding too much middleware
- Ignoring error handling
Chapter Summary
- Express is a web framework for Node
- It simplifies routing
- Middleware adds features
- Built on http
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: