... in the previous chapters...

Modern JavaScript features you can use in Node.js 26

A batch of genuinely useful JavaScript additions is now unflagged in Node.js 26: Set operations (union, intersection, difference), lazy iterator helpers, RegExp.escape, Promise.try, Array.fromAsync, and Float16Array. Here's each one with real, verified output.

Temporal: the modern way to handle dates in Node.js

JavaScript's broken Date object finally has a replacement. Temporal — Stage 4 in ES2026 and enabled by default in Node.js 26 — brings immutable date/time types, real time-zone support, and sane arithmetic. Here's how to use it, with examples and the polyfill for older environments.

The HTTP QUERY method: GET semantics with a request body

The new HTTP QUERY method (RFC 10008, 2026) gives you the safe, idempotent, cacheable semantics of GET with the request body of POST — ideal for large or structured read operations. Here's its status, browser and server support, and a form + fetch + Node example you can actually test.

How to set up Tailwind CSS v4

Tailwind CSS v4 is CSS-first: no tailwind.config.js, no @tailwind directives, and automatic content detection. Here's how to set it up with Vite, PostCSS, or the CLI, customize your theme with @theme, and migrate from v3.

How to save a web page as PNG or PDF with Puppeteer?

Turn any web page into a PDF or a full-page PNG screenshot with Puppeteer and headless Chrome — natively, in just a few lines, with none of the Xvfb, DPI, or screenshot-stitching workarounds the old Nightmare approach required.

How to Use Quill (with react-quill-new) and Distinguish <ul> vs <ol> Lists Using getSemanticHTML()

Quill internally renders both bullet and numbered lists as <ol> elements, which can break list semantics when saving content. Using getSemanticHTML() with react-quill-new ensures your exported HTML correctly distinguishes between <ul> and <ol>.

Next.js ChunkLoadError after deploying: why open tabs break and how to fix it (tested on Next.js 16)

ChunkLoadError: Failed to load chunk after a deploy isn't a build cache problem. It's version skew: a tab opened before the deploy asks for a JavaScript file that the new build deleted. I reproduced it in Next.js 16.3 and tested the fixes: keeping old static files, reloading once on ChunkLoadError, what deploymentId does and doesn't do, and the CDN cache that leaves pages silently dead.

Call a child component's method from the parent in React 19: ref as a prop + useImperativeHandle

In React 19 you don't need forwardRef any more: ref is a regular prop, and useImperativeHandle lets a child expose methods like focus() or clear() to its parent. Here's the pattern in JavaScript and TypeScript, tested in Chromium, Firefox and WebKit with React 19.3, plus the StrictMode bug in the classic example, ref cleanup functions, and the key trick that often makes imperative calls unnecessary.

Total memory used by all Docker containers: a correct docker stats summary (and why summing MEM % is wrong)

docker stats shows memory per container but no total. The usual one-liner sums the MEM % column, and that's wrong as soon as any container has a memory limit. In a test it reported 13.53 GiB used, 174% of the machine, when the containers were really using about 1 GB. Here's a correct shell version, a Node.js version that groups by Compose project, and what the number actually measures.

Pretty-print JSON in JavaScript with JSON.stringify(): indentation, replacers, and what silently gets lost

JSON.stringify(value, null, 2) pretty-prints any object without a library. Here's what the other two arguments do, which values JSON silently drops or mangles (undefined, NaN, Map, Set, Date), which ones throw (BigInt, circular references), and the newer JSON.rawJSON() for numbers too big for JavaScript. All output is real, from Node 24 and 26.

Load-balance Node.js containers with nginx and Docker Compose, and scale without reloading nginx

Run several Node.js containers behind nginx with Docker Compose, spread requests evenly with least_conn, and add or remove replicas without touching nginx, using the resolve option that open-source nginx gained in 1.27.3. Measured: 73 → 279 req/s going from 1 to 4 replicas, and zero failed requests while scaling down, once one easy-to-miss timeout is set. Also: why the classic Docker-DNS nginx config silently ignores its own upstream block.

Block IP addresses in Node.js and Express: net.BlockList, ::ffff: addresses and X-Forwarded-For spoofing

Block single IPs, ranges and CIDR subnets in a Node.js or Express server with the built-in net.BlockList, without any package. The common snippet, x-forwarded-for || remoteAddress, fails twice: it never matches because Node reports ::ffff: addresses, and any client can bypass it with one header. Here's a version that works directly and behind nginx, tested on Node 24 and 26 with Express 5.

About Code with Node.js

This is a personal blog and reference point of a Node.js developer.

I write and explain how different Node and JavaScript aspects work, as well as research popular and cool packages, and of course fail time to time.