mir-backend-node-expresslisted
Install: claude install-skill anantbhandarkar/make-it-right
# /mir-backend-node-express · Make It Right (Express)
Bottom tier of the chain: `mir-backend` (generic gates) → `mir-backend-node` (V8/Node event-loop model) → **this** (Express library mechanics). Run the gates first; load the Node runtime tier for event-loop and process-model concerns; reach for *this* at Gate 5 (design mechanics), Gate 6 (implementation), and Gate 7 review. **Runtime-level concerns (blocking the event loop, worker_threads, unhandled rejections, stream backpressure, AbortController timeouts, heap limits) live in `mir-backend-node` — not here.**
**Stack assumed:** Express 4.x or 5.x on Node 20+ LTS. Version differences that change behavior are called out explicitly.
## The Express footguns AI walks into most
### 1. Async errors in Express 4 are silently swallowed — Express 5 changes this
This is the single most common Express reliability defect AI ships.
**Express 4** does not await route handler return values. If an `async` handler throws, the error is an unhandled promise rejection — it does **not** reach your `(err, req, res, next)` error handler, and the request hangs until the client times out:
```js
// WRONG in Express 4 — thrown error is an unhandled rejection, request hangs
app.get('/users/:id', async (req, res) => {
const user = await db.findUser(req.params.id); // throws → disappears
res.json(user);
});
```
Fix: wrap with a helper that forwards rejections to `next`, or explicitly catch and call `next(err)`:
```js
// Option A — asyncHan