fix: write matched pattern into ctx.route (#3113)

Fixes https://github.com/denoland/fresh/issues/3112
This commit is contained in:
Marvin Hagemeister
2025-07-18 22:38:56 +02:00
committed by GitHub
parent 83da608504
commit 39737b4530
5 changed files with 41 additions and 0 deletions
+12
View File
@@ -49,6 +49,18 @@ app.get("/", (ctx) => {
});
```
## `.route`
Contains the matched route pattern as a `string`. Will be `null` if no pattern
matched.
```ts
app.get("/foo/:id", (ctx) => {
console.log(ctx.route); // Logs: "/foo/:id
// ...
});
```
## `.params`
Contains the params of the matched route pattern.