Skip to content

docs: correct routing example code#3937

Open
kricsleo wants to merge 1 commit intonitrojs:mainfrom
kricsleo:docs/routing-section
Open

docs: correct routing example code#3937
kricsleo wants to merge 1 commit intonitrojs:mainfrom
kricsleo:docs/routing-section

Conversation

@kricsleo
Copy link
Member

🔗 Linked issue

resolves #3936

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@kricsleo kricsleo requested a review from pi0 as a code owner January 10, 2026 12:21
@vercel
Copy link

vercel bot commented Jan 10, 2026

@kricsleo is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

📝 Walkthrough

Walkthrough

This PR corrects documentation examples by replacing the non-existent defineConfig function with the actual defineNitroConfig export from the Nitro config module, and updates route rule examples to use valid JavaScript object patterns with unique keys.

Changes

Cohort / File(s) Summary
Routing Configuration Documentation
docs/1.docs/5.routing.md
Replaces defineConfig with defineNitroConfig and restructures routeRules with unique keys (blog2/, blog3/, blog4/) to resolve duplicate key conflicts. Adds new proxy route rules for /proxy/example and /proxy/.
Deployment Documentation
docs/2.deploy/20.providers/cloudflare.md
Adds explicit import for defineNitroConfig and replaces invocation of defineConfig with defineNitroConfig.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'docs: correct routing example code' follows conventional commits format with type prefix and clearly summarizes the documentation fix.
Description check ✅ Passed The PR description links to issue #3936 and marks documentation updates as completed, relating to the changeset's focus on correcting routing documentation.
Linked Issues check ✅ Passed The PR changes correctly address issue #3936 by replacing defineConfig with defineNitroConfig and fixing duplicate route keys (/blog/**) in the routing documentation example.
Out of Scope Changes check ✅ Passed All changes are scoped to correcting routing documentation examples in markdown files, directly addressing the linked issue #3936 without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99691fc and 51a6b9f.

📒 Files selected for processing (2)
  • docs/1.docs/5.routing.md
  • docs/2.deploy/20.providers/cloudflare.md
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: nitrojs/nitro PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T11:45:17.435Z
Learning: Update types and JSDoc for API changes
📚 Learning: 2025-12-24T11:45:17.435Z
Learnt from: CR
Repo: nitrojs/nitro PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T11:45:17.435Z
Learning: Update types and JSDoc for API changes

Applied to files:

  • docs/2.deploy/20.providers/cloudflare.md
📚 Learning: 2025-12-03T19:09:13.905Z
Learnt from: medz
Repo: nitrojs/nitro PR: 3834
File: src/presets/cloudflare/server-entry.ts:63-63
Timestamp: 2025-12-03T19:09:13.905Z
Learning: In the Nitro Cloudflare preset (src/presets/cloudflare/server-entry.ts), native errors from oxc-parser and Node.js readFile operations should be allowed to bubble up naturally without wrapping, as their native error messages are more user-friendly and provide better diagnostic information.

Applied to files:

  • docs/2.deploy/20.providers/cloudflare.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: tests-rollup (ubuntu-latest)
  • GitHub Check: tests-rollup (windows-latest)
  • GitHub Check: tests-rolldown (windows-latest)
  • GitHub Check: tests-rolldown (ubuntu-latest)
🔇 Additional comments (2)
docs/1.docs/5.routing.md (1)

334-349: ✅ Routing documentation example corrected.

The changes directly address all issues from #3936:

  • defineNitroConfig is now properly imported and used in the export (no longer unused)
  • Replaced non-existent defineConfig with the actual defineNitroConfig function
  • Replaced duplicate /blog/** keys with unique, valid JavaScript object keys (/blog/**, /blog2/**, /blog3/**, /blog4/**)

The corrected example now demonstrates valid syntax and actual API usage with comprehensive route rule patterns.

docs/2.deploy/20.providers/cloudflare.md (1)

22-24: ✅ Cloudflare documentation consistently updated.

All four configuration examples now consistently use defineNitroConfig from "nitro/config", aligning with the corrected routing documentation. No API mismatches or deprecated patterns remain.

Also applies to: 93-95, 119-121, 320-322


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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 10, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@3937

commit: 51a6b9f

import { defineNitroConfig } from "nitro/config";

export default defineConfig({
export default defineNitroConfig({
Copy link
Member

Choose a reason for hiding this comment

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

It is defineConfig from nitro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation of routing API untested, doesn't align with reality

2 participants