You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/event-handler/rest.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,35 @@ All dynamic route parameters will be available as typed object properties in the
91
91
92
92
You can also nest dynamic paths, for example `/todos/:todoId/comments/:commentId`, where both `:todoId` and `:commentId` will be resolved at runtime.
93
93
94
+
#### Catch-all routes
95
+
96
+
For scenarios where you need to handle arbitrary or deeply nested paths, you can use regex patterns directly in your route definitions. These are particularly useful for proxy routes or when dealing with file paths.
97
+
98
+
**We recommend** having explicit routes whenever possible; use catch-all routes sparingly.
99
+
100
+
##### Using Regex Patterns
101
+
102
+
You can use standard [Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions){target="_blank" rel="nofollow"} in your route definitions, for example:
- Routes are matched in **order of specificity**, not registration order
119
+
- More specific routes (exact matches) take precedence over regex patterns
120
+
- Among regex routes, the first registered matching route wins
121
+
- Always place catch-all routes (`.*`) last
122
+
94
123
### HTTP Methods
95
124
96
125
You can use dedicated methods to specify the HTTP method that should be handled in each resolver. That is, `app.<httpMethod>()`, where the HTTP method could be `delete`, `get`, `head`, `patch`, `post`, `put`, `options`.
0 commit comments