docs: fix misleading middleware example path in routing docs (#4354)#4356
docs: fix misleading middleware example path in routing docs (#4354)#4356rafaumeu wants to merge 1 commit into
Conversation
|
@rafaumeu is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe routing documentation example for route-scoped middleware has the handler path corrected from ChangesRouting Docs: Route-Scoped Middleware Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/1.docs/5.routing.md (1)
407-419:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winUpdate the duplicate route-scoped middleware example to use the corrected path.
There is a second example of route-scoped middleware at lines 407–419 that still references the old handler path
./server/middleware/api-auth.tsat line 414. This creates documentation inconsistency: the primary example (lines 267–279) has been corrected to./server/utils/api-auth.ts, but this secondary example contradicts that guidance. Readers may encounter either example and receive conflicting advice.🔧 Proposed fix to align the second example
{ route: "/api/**", - handler: "./server/middleware/api-auth.ts", + handler: "./server/utils/api-auth.ts", middleware: true, },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/1.docs/5.routing.md` around lines 407 - 419, Update the handler path in the route-scoped middleware example shown at lines 407-419 in the nitro.config.ts code block. Change the handler path reference from the old location `./server/middleware/api-auth.ts` to the corrected path `./server/utils/api-auth.ts` to align with the primary example that was previously corrected at lines 267-279 and eliminate the documentation inconsistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/1.docs/5.routing.md`:
- Around line 407-419: Update the handler path in the route-scoped middleware
example shown at lines 407-419 in the nitro.config.ts code block. Change the
handler path reference from the old location `./server/middleware/api-auth.ts`
to the corrected path `./server/utils/api-auth.ts` to align with the primary
example that was previously corrected at lines 267-279 and eliminate the
documentation inconsistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 16ce2158-64e2-4780-b667-afc5ba59fbc3
📒 Files selected for processing (1)
docs/1.docs/5.routing.md
1f020b0 to
b099fd0
Compare
|
Thanks for PR but example is correctly using relavant |
Fixes #4354
Changed the route-scoped middleware example to use
./server/utils/api-auth.tsinstead of./server/middleware/api-auth.tsto avoid confusion with global middleware behavior.Also added a warning note clarifying that files in
server/middleware/run globally regardless of theroutepattern.