Skip to content

Commit 583d576

Browse files
committed
docs(controllers): add warning about route parameter ordering
1 parent f4365fb commit 583d576

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/controllers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ getDocs(@Query('version') version) {
268268

269269
Routes with static paths won't work when you need to accept **dynamic data** as part of the request (e.g., `GET /cats/1` to get cat with id `1`). In order to define routes with parameters, we can add route parameter **tokens** in the path of the route to capture the dynamic value at that position in the request URL. The route parameter token in the `@Get()` decorator example below demonstrates this usage. Route parameters declared in this way can be accessed using the `@Param()` decorator, which should be added to the method signature.
270270

271+
> info **Warning** Routes with parameters should be declared after any static paths. This prevents the parameterized paths from intercepting traffic destined for the static paths.
272+
271273
```typescript
272274
@@filename()
273275
@Get(':id')

0 commit comments

Comments
 (0)