docs: replace deprecated v1 createRouter/router.use with v2#1337
Conversation
- security.md: createRouter() + router.use() → app.all() - validate-data.md: router.use() → app.all() (3 occurrences) - cors.ts JSDoc: createRouter() + router.use() → app.all() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR updates route registration patterns across documentation and code examples, replacing Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/4.examples/validate-data.md`:
- Around line 49-51: Update the explanatory comment above the route that
currently reads “You must use a router to use params” to avoid v1 terminology
confusion; instead, clarify that route parameters are supported by app methods
(e.g., app.all) and routers alike and reference the example path
"/content/:topic/:uuid" so readers know params work with
app.all("/content/:topic/:uuid", ...) as well as with express.Router instances.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b239f293-c653-493a-807e-094e44f61ef9
📒 Files selected for processing (3)
docs/2.utils/4.security.mddocs/4.examples/validate-data.mdsrc/utils/cors.ts
| app.all( | ||
| // You must use a router to use params | ||
| "/content/:topic/:uuid", |
There was a problem hiding this comment.
Update outdated wording about router usage in params example.
Line 50 says “You must use a router to use params”, but the snippet now demonstrates app.all(...). Please reword this note to avoid v1 terminology confusion.
Suggested doc tweak
-app.all(
- // You must use a router to use params
+app.all(
+ // Use a path pattern with params
"/content/:topic/:uuid",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| app.all( | |
| // You must use a router to use params | |
| "/content/:topic/:uuid", | |
| app.all( | |
| // Use a path pattern with params | |
| "/content/:topic/:uuid", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/4.examples/validate-data.md` around lines 49 - 51, Update the
explanatory comment above the route that currently reads “You must use a router
to use params” to avoid v1 terminology confusion; instead, clarify that route
parameters are supported by app methods (e.g., app.all) and routers alike and
reference the example path "/content/:topic/:uuid" so readers know params work
with app.all("/content/:topic/:uuid", ...) as well as with express.Router
instances.
Summary
Replace deprecated v1
createRouter()+router.use()patterns with v2app.all()in docs and JSDoc:docs/utils/security.md— handleCors exampledocs/examples/validate-data.md— 3 validation examplessrc/utils/cors.ts— handleCors JSDoc examplecreateRouteris a v1 API aliased in_deprecated.ts. In v2, routes are registered directly on theH3instance.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit