The example uses res.format() to send different responses (HTML, JSON, text) depending on what the client asks for using the Accept header.
But the example does not include the Vary: Accept header.
Without this header, caches (like CDNs or proxies) may save one version of the page and give that same version to every user—even if they asked for a different format.
This means someone asking for JSON might accidentally get HTML from the cache.
Adding:
res.vary('Accept')
before calling res.format() tells caches that the response depends on the Accept header, so each format is cached correctly.