From 5cbf8b49d3e3c329c9c116c1098aeaa67a98e425 Mon Sep 17 00:00:00 2001 From: vibhor-aggr <108814060+vibhor-aggr@users.noreply.github.com> Date: Sat, 11 Jul 2026 12:25:12 +0530 Subject: [PATCH] docs: add router callable API --- src/content/api/4x/api/router/index.mdx | 25 +++++++++++++++++++++++++ src/content/api/5x/api/router/index.mdx | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/content/api/4x/api/router/index.mdx b/src/content/api/4x/api/router/index.mdx index 0311139d03..34be877186 100644 --- a/src/content/api/4x/api/router/index.mdx +++ b/src/content/api/4x/api/router/index.mdx @@ -121,6 +121,31 @@ router.get('/events', (req: Request, res: Response) => { app.use('/calendar', router); ``` +### router(req, res, [next]) + + + + + The request object. + + + The response object. + + + The callback to pass control to the next matching middleware. + + + + +Dispatches `req` and `res` through the router's middleware and route stack. +Express uses this callable form when a router is mounted with `app.use()` or +`router.use()`. + +If no middleware ends the response, or if a middleware passes control by calling +`next()`, the optional `next` callback receives control. If a middleware calls +`next(err)`, Express skips the remaining non-error handlers and calls `next` with +the error. + ### router.all() diff --git a/src/content/api/5x/api/router/index.mdx b/src/content/api/5x/api/router/index.mdx index af72f1c1a1..386d459172 100644 --- a/src/content/api/5x/api/router/index.mdx +++ b/src/content/api/5x/api/router/index.mdx @@ -121,6 +121,31 @@ router.get('/events', (req: Request, res: Response) => { app.use('/calendar', router); ``` +### router(req, res, [next]) + + + + + The request object. + + + The response object. + + + The callback to pass control to the next matching middleware. + + + + +Dispatches `req` and `res` through the router's middleware and route stack. +Express uses this callable form when a router is mounted with `app.use()` or +`router.use()`. + +If no middleware ends the response, or if a middleware passes control by calling +`next()`, the optional `next` callback receives control. If a middleware calls +`next(err)`, Express skips the remaining non-error handlers and calls `next` with +the error. + ### router.all()