In Express.js, router.all() registers handlers on an express.Router() that run for every HTTP method. After you mount the router with app.use('/users', router), router.all('/profile', …) matches GET, POST, PUT, and DELETE to /users/profile.
Use it for shared module logic — logging, auth, or loading a user — then call next() so a method route such as router.get() can finish the response. The path is relative to the mount. It is not a browser API; it runs inside your Express server.
Syntax
Call router.all in your Express.js app. Start with this line.
GET /members/account (no header)
→ 401 Login required
GET /members/account (header x-user: Ada)
→ requireAuth ✓ → loadUser sets req.user →
200 { "id": 1, "name": "Ada" }
How It Works
Pass a list of handlers.members.all('/account', requireAuth, loadUser) runs them in order for every method. The public URL is /members/account.
Gate first.requireAuth stops with 401 when the header is missing.
Enrich the request.loadUser sets req.user, then calls next().
Answer in the method route.members.get('/account') sends the loaded user as JSON.
Compatibility
Runtime Support
router.all() is an Express.js router method. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers do not execute it — they only send HTTP requests to your app.
✓ Server · Express 4 & 5
router.all()
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
router.all()Express on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Copy a snippet into a local file and start the server with node.
Frequently Asked Questions
It registers one or more handlers on an Express Router for a path that run for every HTTP method — GET, POST, PUT, PATCH, DELETE, and the others.
The verb behavior is the same. router.all() lives on a router, so the path is relative to where you mount that router with app.use(). It does not see routes registered on the main app or on a different router.
router.all() is a route for one path and every HTTP method. router.use() mounts middleware or another router, often as a prefix that also matches paths underneath it.
Yes, if a later handler should run. Sending a response (res.send, res.json, and so on) without next() stops the chain — correct for a 401. next('route') skips the rest of this route and lets Express try the next matching route.
No. Express runs on a Node.js (or compatible) server. Browsers only send HTTP requests; they do not execute router.all().