Blog

Posts tagged “Express”

Express logging in production: three JSON log lines from pino-http with request ID, route pattern /v1/orders/:orderId, a redacted password on a 401 and a 500 on the refund route (illustrative)
Logging

Express logging in production: pino-http vs morgan, request bodies and redaction

morgan, pino-http or winston? A production Express logging setup on Express 5: one JSON line per request with request ID, route and user, bodies for failed requests only, pino redaction, and errors on the same line.

Jason Fill November 13, 2026 11 min read
Node.js API logging: 'What to log for every API request' beside illustrative JSON log lines with route /orders/:id, status 200, responseTime, reqId and userId, a 401 on /login with the password redacted, and an outbound call sharing the same request ID.
Logging

Node.js API logging: what to log for every request, and how

Most Node.js API logs can't answer "what happened to this customer's request?" This guide covers the six fields every request line needs, safe body capture that keeps streaming intact, redaction, outbound calls, and the queries to run, with code tested on Node 22 and 24.

Jason Fill November 13, 2026 19 min read
ApiTraffic header: Express monitoring by route, not by URL, with a /metrics output panel listing route-labelled request counts for 200, 201, 404 and 500 responses
Monitoring

Express monitoring: route-level metrics, APM and alerts for Express 4 and 5

Most Express metrics are labelled by raw URL and miss async errors. Build route-level metrics with prom-client, add OpenTelemetry in the right load order, and set alerts, with code we ran on Express 4.22.3 and 5.3.0.

Jason Fill November 12, 2026 11 min read
Header: 'Node.js API monitoring: What to measure, how to set it up, and which tools fit a small team', with a metrics panel from the guide's example: /orders/:id p95 250ms and 2.0% 5xx, /report p95 250ms, unmatched 404, event loop delay p50 120.8ms against an idle 20.2ms.
Monitoring

Node.js API monitoring: what to measure, how to set it up, and which tools fit a small team

Uptime checks miss most of what breaks a Node API. What to measure per route and per process, a tested Express middleware for RED metrics and event loop delay, where OpenTelemetry fits, a fair tool comparison and the alerts worth paging on.

Jason Fill November 12, 2026 16 min read
Header: 'Your auth check passed. Now prove what the agent did.' beside an illustrative request log of one agent run, including a duplicate refund and a denied DELETE.
Security

Your auth check passed. Now prove what the agent did.

An agent calls your API with a valid token, the scopes allow it, and the write lands with a clean 201. Nobody asked for it. Here's how to fix authorization for agents first, then build an audit trail that shows exactly what the agent did.

Jason Fill November 12, 2026 7 min read
Bar chart: ALB idle timeout 60 s, old Node keepAliveTimeout 5 s causing a 502 when the ALB reuses a closed socket, and a fixed keepAliveTimeout of 65 s, with the code server.keepAliveTimeout = 65_000; server.headersTimeout = 66_000;
Monitoring

Node.js server timeouts: requestTimeout, headersTimeout and keepAliveTimeout

Random 502s behind a load balancer often come down to one setting: keepAliveTimeout. What each Node.js server timeout controls, safe values behind an AWS ALB, and how to confirm the fix.

Jason Fill November 11, 2026 5 min read
Header: 'Observability for a 5-person Node team' with four cards: Errors (what threw, in which release), APM (what's slow, and why), OpenTelemetry (instrument once, send anywhere), Request log (who called, and what they sent).
Monitoring

Observability for a 5-person Node team: what each option actually gives you

When a customer says the export failed again, how long until you see the exact request? For most small Node teams the answer is spread across three tools. Here's what each option is built for, the gaps that bite, and a setup you can copy.

Jason Fill November 10, 2026 6 min read
Illustrative request log for user u_118: POST /orders 201, the payment step skipped, then POST /orders/8812/confirm 200, flagged reason=step_skipped missing=payment. Headline: Every request got a 200. Nobody paid.
Security

API business logic abuse: requests that are valid but wrong

Akamai says 61% of API attacks in 2025 involved unauthorized workflows, double the year before. Four examples for a small SaaS, how to map the expected order of calls, and Express code to catch the ones that skip a step.

Jason Fill November 9, 2026 5 min read
401 vs 403 in your API logs: illustrative log lines showing a burst of 401s on POST /login from one IP ending in a 200, then 403s on sequential invoice IDs
Debugging

401 vs 403 in your Node API logs: what each pattern means

401 and 403 look alike in a log but answer different questions. What each means under RFC 9110, four auth patterns worth an alert, how to return the right one in Express and Fastify, and five searches to run on last week's logs.

Jason Fill November 8, 2026 4 min read
Header image: Scanners want your .env and your .mcp.json
Security

Block .env and config-file probes in Express and Fastify

One site logged 1,028 requests for credential paths in a day, including /.mcp.json and other AI tool configs. How to check none can succeed, return a fast 404 in Express and Fastify, and block the IPs doing it.

Jason Fill November 6, 2026 4 min read
Before and after: a Node.js login that answered 401 'Wrong password' or 404 'No account' with different timings now answers 401 'Invalid email or password' in about 33 ms for both real and unknown emails.
Security

Stop user enumeration on your Node.js login, signup and reset endpoints

AI agents made hundreds of millions of requests to login pages in the first half of 2026. If your API answers differently for real and unknown emails, it hands them a target list. Here's how to make login, reset and signup give one answer.

Jason Fill November 5, 2026 6 min read
Header: 'Webhooks that fail one time in ten.' beside an illustrative webhook log: a 401 signature mismatch on an amount of 24.50, the same event handled twice after a slow 4.1 s response and a retry, and a fast queued 200.
Debugging

Debugging webhooks in Node: failed signatures, retries and duplicate events

Webhook bugs rarely reproduce on your laptop: a signature check that fails one time in ten, the same event processed twice, a retry storm after a slow deploy. Here's the fix for each, plus how to get the exact request in front of you.

Jason Fill November 5, 2026 6 min read