In Express.js, app.all() registers handlers for a path that run for every HTTP method. A request to /secret with GET, POST, PUT, or DELETE all hit the same app.all('/secret', …) stack.
Use it for shared route logic — logging, auth, or loading a user — then call next() so a method-specific route like app.get() can finish the response. It is not a browser API; it runs inside your Express server.
Syntax
Call app.all in your Express.js app. Start with this line.
Required. Route path to match. Strings match the whole path. Arrays match any listed path.
callback
Required. One or more handlers: (req, res, next) => { … }. Can call next('route') to skip remaining callbacks for this route.
Return Value
app.all() returns the same application object (app), so chaining is possible. In real apps you almost always ignore the return value and register each route on its own line.
Express
// Same app instance comes back — chaining works, but is uncommon:
app.all('/secret', gate).get('/secret', handler);
// Typical style — ignore the return value:
app.all('/secret', gate);
app.get('/secret', handler);
Express.js Examples
Example 1 — Log Every Method on One Path
Print the method and URL for any request to /secret, then continue.
GET /secret
Accessing the secret section ...
→ Response body: Secret GET
POST /secret
Accessing the secret section ...
→ (continues to the next matching route, if any)
How It Works
Match the path only.app.all('/secret', …) cares about the path, not the verb.
Log, then continue.console.log runs, then next() hands control to the next matching handler.
GET gets a reply.app.get('/secret') sends Secret GET after the log line.
Other methods still enter app.all. POST or DELETE also log; they only get a body if you add matching routes.
Example 2 — Auth Gate for a Path Prefix
Require a header before any method under /api can continue. Express 5 uses a named splat.
Pass a list of handlers.app.all('/account', requireAuth, loadUser) runs them in order for every method.
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.app.get('/account') sends the loaded user as JSON.
Compatibility
Runtime Support
app.all() is an Express.js application 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
app.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
app.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 for a path that run for every HTTP method Express supports — GET, POST, PUT, PATCH, DELETE, and others.
Use app.all() for shared path logic that must run no matter which method arrives — auth checks, logging, or attaching request context — then keep method-specific handlers for the real response.
app.all() is a routing method for a path and all verbs, like app.METHOD(). app.use() mounts middleware (often with a prefix) and is the usual way to attach routers and global middleware.
Yes, if a later handler should run. If you send a response (res.send, res.json, and so on) without calling next(), the chain stops — which is correct for a hard deny like 401. Use next('route') to skip remaining handlers on the current route and try the next matching route.
No. Express runs on a Node.js (or compatible) server. Browsers only send HTTP requests to your server; they do not execute app.all().