Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Nov 3, 2025

Fixes #33642

Route middleware only runs during page navigation (Vue Router), not for API routes. Added callout to clarify this.

Implementation:

@onmax onmax requested a review from danielroe as a code owner November 3, 2025 08:12
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Walkthrough

An additional important block was inserted into the routing documentation after the existing Route Middleware note. The new block explicitly states that route middleware does not run for server routes (for example, /api/*) or other server requests and directs readers to use server middleware for those requests. No functional code changes, deletions, or exported/public declarations were modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Documentation-only change with consistent formatting
  • Single-file, single-block insertion
  • No logic, API, or structural changes to validate
  • Minimal risk; no special areas require extra attention

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'docs: clarify route middleware doesn't affect API routes' directly and clearly summarizes the main change in the changeset. It accurately reflects that the PR adds documentation clarification about route middleware's scope, specifically that it does not affect API routes. The title is concise, specific, and immediately conveys the primary purpose of the documentation update.
Description check ✅ Passed The pull request description is directly related to the changeset. It references the linked issue (#33642), explains that a callout was added to clarify route middleware behaviour, and provides implementation context showing where route middleware is implemented in the codebase. The description adequately conveys what was changed and why, making it clear and relevant to the changes.
Linked Issues check ✅ Passed The pull request successfully addresses all primary objectives from linked issue #33642. It adds an explicit callout to the route middleware documentation clarifying that route middleware only runs during page navigation and does not affect API routes or server requests. The change directly implements the suggestion provided in the issue to add a note explaining the distinction between route middleware (client-side Vue Router guards) and server middleware (Nitro/h3 request handlers). All coding-related requirements from the linked issue have been met.
Out of Scope Changes check ✅ Passed The changeset contains only documentation modifications to the routing guide, which are entirely in scope for addressing the confusion identified in issue #33642. The addition of the clarification block about route middleware scope is directly aligned with the linked issue's objectives and does not introduce any unrelated changes. All modifications are focused solely on improving documentation clarity regarding middleware behaviour.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/1.getting-started/07.routing.md (1)

93-95: Remove trailing period before closing marker for consistency.

The content effectively clarifies the scope of route middleware and aligns well with the PR objectives. However, the period before the closing :: is unusual for Markdown callout block formatting.

Apply this diff to align with typical documentation conventions:

 ::important
-Route middleware does **not** run for server routes (e.g. `/api/*`) or other server requests. To apply middleware to these requests, use [server middleware](/docs/4.x/guide/directory-structure/server#server-middleware) instead.
+Route middleware does **not** run for server routes (e.g. `/api/*`) or other server requests. To apply middleware to these requests, use [server middleware](/docs/4.x/guide/directory-structure/server#server-middleware) instead
 ::

The content itself directly addresses the confusion identified in issue #33642 and provides clear guidance on using server middleware for API route interception.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2fcf1ef and 230e9e1.

📒 Files selected for processing (1)
  • docs/1.getting-started/07.routing.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/1.getting-started/07.routing.md

[uncategorized] ~94-~94: Loose punctuation mark.
Context: ...ture/server#server-middleware) instead. :: There are three kinds of route middle...

(UNLIKELY_OPENING_PUNCTUATION)

@danielroe danielroe merged commit 7ac5ae2 into nuxt:main Nov 3, 2025
7 of 8 checks passed
@github-actions github-actions bot mentioned this pull request Nov 3, 2025
@onmax onmax deleted the docs/clarify-middleware-scope branch November 3, 2025 11:26
@github-actions github-actions bot mentioned this pull request Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Route Middleware vs Server Middleware Confusion

3 participants