Routed middleware: params, tracing and ordering docs
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 51/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend, documentation
Research direction
Read docs/1.docs/50.lifecycle.md and docs/1.docs/5.routing.md, then trace routed middleware through src/runtime/internal/app.ts and #nitro/virtual/routing to confirm the behavior described. Document that routed middleware run after global middleware and follow rou3 matchAll order, from least to most specific. Done when both docs explain the ordering clearly.
Written by the indexing model from the issue text.
Description
Follow-up from #5090. Routed middleware (server/middleware with a route, dispatched by createRoutedMiddleware in src/runtime/internal/app.ts) has a few gaps compared to h3's app.use(route, mw):
- Params: h3 sets
event.context.middlewareParamsfrom the matched route. Nitro's routed dispatcher drops the params fromfindRoutedMiddleware, so a middleware on/users/:idcannot readid. - Tracing: the dispatcher is opted out of
h3/tracing(markUntraced), and routed middleware are not wrapped withwrapHandlerWithTracingin#nitro/virtual/routing(only routes are), so they produce no spans. - Docs: routed middleware run after global middleware, in rou3
matchAllorder (least to most specific:/**,/:a/users,/api/**,/api/:id,/api/users), not in registration order.docs/1.docs/50.lifecycle.mdanddocs/1.docs/5.routing.mddo not say this.
Opened with AI assistance.
- Dominant language
- TypeScript
- Stars
- 11.5k
- Forks
- 968
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 64
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nitrojs/nitro
-
pending triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 2 days
-
cloudflare: `nitro deploy` fails when a parent directory has a Wrangler configPossibly taken @draarivpatel-ui claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 2 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
pending triage
Difficulty 5/5 Over a week Newbie friendliness 30/100
nitrojs/nitro#5205 · 1 reaction ·
Maintainers usually reply within 2 days
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ranxianglei/billion-context#8319 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JimLiu/open-artifact#126 ·
-
bug repro-ready
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
mksglu/context-mode#1454 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
laststance/design-world#98 ·
Maintainers usually reply within 1 day
-
Add: KCM True crimeOpenapproved check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day