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()