... in the previous chapters...
Bundle a Preact (or React) app into one standalone script with esbuild or Rollup
Ship a Preact widget as a single <script> tag that any page can mount, with no framework on the host page. One esbuild command (or a 20-line Rollup 4 config with no Babel), updated for Preact 11, plus real size numbers: 6 kB gzipped for Preact versus 69 kB for the same component on React 19.
Parse URL query parameters in JavaScript: URLSearchParams, its gotchas, and reacting to changes
URLSearchParams parses query strings in every browser and in Node.js. Here's how to read, convert and update parameters, the gotchas that cause real bugs (+ becoming a space, repeated keys, Object.fromEntries dropping values), URL.parse(), and how to react when the query string changes. Every example verified in Node 24 and 26, and in headless Chromium, Firefox and WebKit.
Create an array from 0 to N in JavaScript: every way, the gotchas, and which is fastest
[...Array(n).keys()] and Array.from({ length: n }, (_, i) => i) both give you [0, 1, …, n-1], but they behave differently for "3", 2.5 or -1, and Array(n).map() doesn't work at all. Here's what each one-liner really does (with real output), a range(start, end, step) helper, the typed-array and floating-point traps, lazy iterator helpers, and a benchmark on Node 24 and 26.
Read and strip image EXIF data with JavaScript: camera, date and GPS in the browser and Node.js
Photos carry EXIF metadata: the camera, the time, and often the exact GPS location. Read it in the browser or in Node.js with ExifReader, then remove it before you publish an upload, without turning portrait photos sideways. Tested with a real GPS-tagged JPEG in Chromium, Firefox and WebKit and on Node 24 and 26.
Build a placeholder image service (placehold.it clone) with Node.js, Express 5 and sharp
A small Express 5 + sharp server that returns placeholder images such as /600x400.webp?bg=0891b2&text=Hello in PNG, WebP, AVIF, JPEG or SVG, in about 11 ms each. It also fixes the problems in the classic version: the Express 5 route error, SVG injection through the text, unbounded image sizes, and the empty boxes you get for text in a slim Docker image.
A contact form in Node.js that actually sends email: Express 5, express-validator, Mustache and Nodemailer
A complete contact form in Node.js: server-side validation with express-validator, Mustache templates that keep what the visitor typed, email delivery with Nodemailer, a honeypot against bots, and POST/Redirect/GET so a refresh doesn't send it twice. Tested end to end against a local SMTP server, including HTML injection, email header injection and what happens when SMTP is down.
How to create a simple HTTP API with authentication with Node.js?
Build a complete authentication flow in Node.js from scratch — user signup with bcrypt-hashed passwords, login that issues auto-expiring JSON Web Tokens, and middleware that protects routes so only authenticated requests get through.