chore(server): upgrade to Express 5 and drop body-parser#1170
chore(server): upgrade to Express 5 and drop body-parser#1170
Conversation
- Bump express 4.22 -> 5.x (and @types/express to v5). Express 5 forwards
rejected promises from async route handlers to error middleware, removing a
class of process-crashing unhandled rejections.
- Replace the standalone body-parser dependency with the bundled
express.json()/express.urlencoded() (body-parser is what Express uses
internally); drop body-parser and @types/body-parser.
- Replace the app.get("*") examples SPA fallback with app.get(/.*/): Express 5 /
path-to-regexp v8 no longer accept the bare "*" string path.
Verified: server boots, base resource routes, the examples SPA fallback, and
the socket.io endpoint all serve; full unit suite passes.
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ 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 |
|
@coderabbitai code review |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh pr view 1170 --repo sockethub/sockethub --json title,body,files,additions,deletions
echo "-----DIFF-----"
gh pr diff 1170 --repo sockethub/sockethubLength of output: 109356 🏁 Script executed: #!/bin/bash
sed -n '1,220p' packages/server/src/listener.tsLength of output: 6653
No functional or structural issues found. This looks safe to merge based on the diff alone; nice, minimal, and well-documented change. [approve] |
Summary
express4.22 → 5.x (and@types/express→ v5)body-parserdependency with the bundledexpress.json()/express.urlencoded()app.get("*")examples SPA fallbackWhy
Express 5 forwards rejected promises from
asyncroute handlers to error middleware, which removes an entire class of process-crashing unhandled rejections (Express 4 does not catch these).body-parseris exactly what Express bundles asexpress.json()/express.urlencoded(), so the separate dependency is redundant.Changes
express→^5.1.0,@types/express→^5.0.0; removedbody-parserand@types/body-parser.listener.ts:bodyParser.urlencoded/json→express.urlencoded/json;app.get("*", …)→app.get(/.*/, …)(path-to-regexp v8 no longer accepts the bare"*"string).routes.tsare unaffected (no wildcard/:parampatterns).Verification
Notes
The related
rate-limit-redisidea (shared cross-instance rate limits) is intentionally not in this PR. Master's onlyexpress-rate-limituser is the examples static-file limiter, where per-instance in-memory limiting is actually the correct behavior — the endpoint that benefits from shared limits is the HTTP actions API on #1036, sorate-limit-rediswill land there instead.Once this merges, #1036 (HTTP actions) will rebase onto Express 5 and can drop its defensive
try/catcharound the async POST handler, since Express 5 handles async rejections natively.