Express Module Methods

About This Index
This page is the express() module index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Call express() to create an app, then mount built-in helpers from the same module: express.json(), express.urlencoded(), express.static(), and express.Router(). Application methods live under /express/app.
Start with const app = express(), add express.json(), then express.static()—open express.Router() when you split routes into modules.
How to Call express() Module APIs
Import the module once, create the app, then mount the built-in factories you need:
const express = require("express");
const path = require("path");
const app = express();
const api = express.Router();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, "public")));
api.get("/health", (req, res) => {
res.json({ ok: true });
});
app.use("/api", api);
app.listen(3000); Express Module Methods Table
All express() module guides in this Express.js tutorial series (4 tutorials).
Body Parsers
2 methodsTurn request bodies into req.body — JSON APIs and HTML forms.
| Method | Description | Tutorial |
|---|---|---|
express.json() | Parse JSON request bodies into req.body — the default body parser for APIs. | Try it |
express.urlencoded() | Parse URL-encoded form bodies (application/x-www-form-urlencoded) into req.body. | Try it |
Static Files
1 methodServe public assets without writing a route for every file.
| Method | Description | Tutorial |
|---|---|---|
express.static() | Serve static files from a folder — CSS, images, client JS, and uploads. | Try it |
Router Factory
1 methodSplit routes into express.Router() modules and mount them on the app.
| Method | Description | Tutorial |
|---|---|---|
express.Router() | Create a modular mini-app router — mount route groups with app.use(). | Try it |
Frequently Asked Questions
Start with express.json()
Open the JSON body-parser guide—syntax, options, and FAQs.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
16 people found this page helpful
