Factories
Entry constructors for composing a nodejs application shell with explicit dependencies.
| Symbol | Purpose | Notes |
|---|---|---|
| createHttpApp | Build a request router with middleware staging | Transport-agnostic where possible for node-js tests |
| createContext | Bind per-request services (logger, id factory) | Keep context narrow to preserve reviewer clarity |
HTTP helpers
| Utility | When to use | Avoid |
|---|---|---|
| parseJsonBody | Controlled JSON parsing with size limits | Parsing untrusted bodies before size checks |
| sendProblem | Consistent problem+json responses | Leaking internal stack traces to clients |
Errors
Error types are designed to classify failures for operators without coupling logs to a single vendor format.
| Type | Meaning | HTTP mapping (typical) |
|---|---|---|
| ValidationError | Input failed schema checks | 400 class |
| AuthnError | Authentication missing or invalid | 401 class |
| AuthzError | Authenticated but not permitted | 403 class |
Telemetry seams
Hooks emit timing spans and counters using interfaces you can bridge to OpenTelemetry or internal agents in node deployments.
| Hook | Emits | Required? |
|---|---|---|
| onRequestStart | Request id + route template | Optional but recommended |
| onHandlerFinish | Duration + outcome class | Optional |
Stability index
Symbols marked experimental may change across minor releases until promoted. Pin versions and read migration notes for each nodejs upgrade cycle.