docs: add From Express.js to h3 migration guide#1412
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughRestores the Express.js → h3 v2 migration guide and adds an examples index link; the guide covers setup, routing, params, query/body handling, cookies, lifecycle hooks, nested apps, error handling, and unavailable Express features. ChangesExpress.js to h3 v2 Migration Guide
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Suggested reviewers
Poem
🚥 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 |
Ports the v1 "From Express.js to h3" migration guide to v2, covering Hello World, routing, URL params, query string, request body, cookies, middleware (onRequest/onResponse hooks), sub-apps (app.mount), and error handling (HTTPError). Includes a compatibility table of Express features and their h3 v2 equivalents. Closes h3js#1240
661268b to
a4e246a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@docs/4.examples/from-expressjs-to-h3.md`:
- Around line 247-249: The onResponse example uses an incorrect Response
property; update the callback passed to onResponse so it references
response.status (not response.statusCode) when logging; locate the onResponse
usage and change the template to use `${response.status}` while keeping the rest
(event.req.method and event.url.pathname) intact so the log shows the HTTP
method, path and correct status value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6efe3701-0525-49d5-b962-4c215fdedb93
📒 Files selected for processing (2)
docs/4.examples/0.index.mddocs/4.examples/from-expressjs-to-h3.md
There was a problem hiding this comment.
♻️ Duplicate comments (1)
docs/4.examples/from-expressjs-to-h3.md (1)
247-249:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse
response.statusin theonResponseexample (Line 248).
onResponsereceives a FetchResponse; usingresponse.statusCodeis inaccurate in this snippet and may confuse migrations.Suggested doc fix
.use(onResponse((response, event) => { - console.log(`[${event.req.method}] ${event.url.pathname} -> ${response.statusCode}`); + console.log(`[${event.req.method}] ${event.url.pathname} -> ${response.status}`); }));🤖 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/4.examples/from-expressjs-to-h3.md` around lines 247 - 249, The example in the onResponse handler uses an incorrect property response.statusCode; update the snippet to use the Fetch Response API property response.status instead. Locate the onResponse usage (the function receiving (response, event)) and replace any references to response.statusCode with response.status so the log line (which also references event.req.method and event.url.pathname) correctly reports the HTTP status from the Fetch Response.
🤖 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.
Duplicate comments:
In `@docs/4.examples/from-expressjs-to-h3.md`:
- Around line 247-249: The example in the onResponse handler uses an incorrect
property response.statusCode; update the snippet to use the Fetch Response API
property response.status instead. Locate the onResponse usage (the function
receiving (response, event)) and replace any references to response.statusCode
with response.status so the log line (which also references event.req.method and
event.url.pathname) correctly reports the HTTP status from the Fetch Response.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d93bf82b-2e1d-4d07-a2d2-9f117f8b4feb
📒 Files selected for processing (2)
docs/4.examples/0.index.mddocs/4.examples/from-expressjs-to-h3.md
✅ Files skipped from review due to trivial changes (1)
- docs/4.examples/0.index.md
Summary
From Express.js to h3to v2 docs #1240)docs/4.examples/0.index.md)Changes
docs/4.examples/from-expressjs-to-h3.md— new migration guidedocs/4.examples/0.index.md— added link to new pageTest plan
new H3(),serve(), utility imports fromh3)createApp,createRouter,fromNodeMiddleware)Summary by CodeRabbit