router.METHOD() is the Express pattern for HTTP verb routes on a router. Replace METHOD with a lowercase verb: router.get(), router.post(), router.put(), router.delete(), and many others. Create the router with express.Router(), then mount it with app.use().
Each call matches one verb on a path relative to the mount. Shared logic for every verb belongs on router.all(). Chain several verbs on one path with router.route(). The app-level twin is app.METHOD().
Syntax
Call router.METHOD in your Express.js app. Start with this line.
GET /books
→ GET request to books
POST /books
→ POST request to books
PUT /books → 404 (no router.put registered)
GET / → 404 (never enters this router)
How It Works
Mount the module.app.use('/books', books) strips /books before the router sees the request. Inside the router the path is /.
Same path, different verbs. Both handlers use '/' on the router.
GET vs POST. Only the matching verb runs. PUT needs its own router.put (or router.all).
Prefix matters. A request to / never enters this router.
Example 2 — Path Params on a Mounted Router
Capture an id with :id. The public URL is /users/:id.
GET /catalog/book → Get a book
POST /catalog/book → Add a book
PUT /catalog/book → Update the book
How It Works
One path.catalog.route('/book') names the resource once on the router.
Chain verbs..get, .post, and .put are METHOD helpers on that route.
Mount adds the prefix. Public URLs are under /catalog.
Fewer typos. You do not repeat '/book' on every line. See router.route().
Compatibility
Runtime Support
router.METHOD() helpers are Express.js router methods. They run on a Node.js server (Express 5 needs Node.js 18+). Browsers only send HTTP requests.
✓ Server · Express 4 & 5
router.METHOD()
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers.
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.METHOD()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 is the family of routing methods on an express.Router() where METHOD is an HTTP verb in lowercase — for example router.get(), router.post(), and router.delete(). Each one matches only that verb.
The matching rules are the same. router.METHOD() lives on a router, so the path is relative to where you mount that router with app.use(). Use it to keep feature routes in their own module.
router.METHOD() matches one HTTP verb. router.all() runs for every verb on that path.
Yes, if you did not register router.head() for that path first. Express also runs the GET handler for HEAD and leaves the body empty.
No. These methods register routes on your Node.js server. Browsers only send HTTP requests with a method and path.