Express Router Methods

Beginner
6 min read
Updated: Nov 2026
5 method guides
Method index

About This Index

This page is the Express Router index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Create a modular stack with express.Router(), then use router.use(), router.METHOD(), and router.route(). Mount the router on the app with app.use(). The factory itself is covered under express.Router().

Beginner path.

Start with router.use() and a GET via router.METHOD()—then router.route() and router.param() as your modules grow.

How to Call a Router Method

Build a Router, add middleware and routes, then mount it on the app:

Express
const express = require("express");
const app = express();
const users = express.Router();

users.use((req, res, next) => {
  console.log("users router:", req.method, req.path);
  next();
});

users.param("id", (req, res, next, id) => {
  req.userId = id;
  next();
});

users.route("/")
  .get((req, res) => res.json([]))
  .post((req, res) => res.sendStatus(201));

users.get("/:id", (req, res) => {
  res.json({ id: req.userId });
});

app.use("/users", users);
app.listen(3000);

Express Router Methods Table

All Router method guides in this Express.js tutorial series (5 tutorials).

Middleware

1 method

Build the Router pipeline — mount middleware and nested routers.

MethodDescriptionTutorial
router.use()Mount middleware or nested routers on this Router — the modular pipeline.Try it

HTTP Routing

3 methods

Define routes by method and path — all, METHOD, and route().

MethodDescriptionTutorial
router.all()Match a path for every HTTP method — shared logic before method-specific routes.Try it
router.METHOD()Register a route for any HTTP verb — get, post, put, patch, delete, and more.Try it
router.route()Create a chainable route for one path — attach .get(), .post(), and more together.Try it

Params

1 method

Run logic when named route parameters appear in the URL.

MethodDescriptionTutorial
router.param()Run callback middleware when a named route parameter is present.Try it

Frequently Asked Questions

express.Router() creates a modular mini-app—its own middleware and route stack. You mount it with app.use('/path', router) so large Express tutorials stay organized.
app is the top-level application. A Router is a portable route module with similar APIs (use, get/post via METHOD, route, param, all) that you mount under a path prefix.
Start with router.use() for middleware, then router.METHOD() (or .get/.post) for routes, then router.route() when one path needs multiple methods.
Use router.param('id', …) to run shared logic whenever :id appears in routes on that router—load a record once instead of repeating it in every handler.
Start with router.use() and a simple GET via router.METHOD(), then open router.route() and router.param() as your modules grow.

Start with router.use()

Open the middleware guide—syntax, examples, and FAQs.

router.use() tutorial →

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.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

16 people found this page helpful