Skip to content

Commit

Permalink
Merge pull request #1 from expressjs/gh-pages
Browse files Browse the repository at this point in the history
Clarify inheritance behaviour of route params in .params (expressjs#1515)
  • Loading branch information
IntegerAlex committed May 17, 2024
2 parents f9b3563 + 7e2d60b commit 692d663
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion _includes/api/en/4x/app-param.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app.param('user', function (req, res, next, id) {
})
```

Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers. Hence, param callbacks defined on `app` will be triggered only by route parameters defined on `app` routes.
Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers, nor are they triggered for route parameters inherited from parent routers. Hence, param callbacks defined on `app` will be triggered only by route parameters defined on `app` routes.

All param callbacks will be called before any handler of any route in which the param occurs, and they will each be called only once in a request-response cycle, even if the parameter is matched in multiple routes, as shown in the following examples.

Expand Down
2 changes: 1 addition & 1 deletion _includes/api/en/4x/router-param.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ router.param('user', function (req, res, next, id) {
})
```

Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers. Hence, param callbacks defined on `router` will be triggered only by route parameters defined on `router` routes.
Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers, nor are they triggered for route parameters inherited from parent routers. Hence, param callbacks defined on `router` will be triggered only by route parameters defined on `router` routes.

A param callback will be called only once in a request-response cycle, even if the parameter is matched in multiple routes, as shown in the following examples.

Expand Down
2 changes: 1 addition & 1 deletion _includes/api/en/5x/app-param.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app.param('user', (req, res, next, id) => {
})
```

Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers. Hence, param callbacks defined on `app` will be triggered only by route parameters defined on `app` routes.
Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers, nor are they triggered for route parameters inherited from parent routers. Hence, param callbacks defined on `app` will be triggered only by route parameters defined on `app` routes.

All param callbacks will be called before any handler of any route in which the param occurs, and they will each be called only once in a request-response cycle, even if the parameter is matched in multiple routes, as shown in the following examples.

Expand Down
2 changes: 1 addition & 1 deletion _includes/api/en/5x/router-param.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ router.param('user', (req, res, next, id) => {
})
```

Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers. Hence, param callbacks defined on `router` will be triggered only by route parameters defined on `router` routes.
Param callback functions are local to the router on which they are defined. They are not inherited by mounted apps or routers, nor are they triggered for route parameters inherited from parent routers. Hence, param callbacks defined on `router` will be triggered only by route parameters defined on `router` routes.

A param callback will be called only once in a request-response cycle, even if the parameter is matched in multiple routes, as shown in the following examples.

Expand Down

0 comments on commit 692d663

Please sign in to comment.