Deviations from Express
Nest 10 / 11 / 12 · Node 22+ / Bun 1.4+
The adapters aim to behave like @nestjs/platform-express. These are the
known differences. The guides have the usage details.
Request and response objects
Section titled “Request and response objects”@Req()and@Res()areNativeRequestandNativeResponse, the same fetch-compatible objects on Node and Bun. They are not Express or Fastify objects, and Express/Fastify plugins do not work.- The request does not expose Express’s
request.destroyedflag, andbaseUrlis always"". res.type()accepts full MIME types, not extension shorthands such as"json".res.vary()skips empty entries where thevarypackage throws.- Redirects always return a plain-text body, rather than Express’s optional Accept-negotiated HTML redirect page.
- Of Express’s
app.set()settings, onlytrust proxyandsubdomain offsethave an effect.
BunHttpAdapterusesBun.serve, notnode:httprunning under Bun. The server object that Nest sees is not a Node server. The Bun server is at its.nativeproperty.- For a buffered or file body,
res.on("finish")fires when the adapter hands the body to Bun, not when Bun flushes it to the socket. - Socket.IO and
@nestjs/platform-wsneedNodeHttpAdapter.BunWsAdapterdoes not support WebSocket namespaces or separate ports.
Routing
Section titled “Routing”- Routes use
path-to-regexp8 syntax. The adapters convert common legacy middleware wildcards, but do not support legacy regular-expression routes.
Uploads
Section titled “Uploads”- Multer’s
fileFilterand per-interceptor options are not supported.uploadFileLimitanduploadFilesLimitapply adapter-wide. - Without an upload interceptor, multipart files are native
Filevalues on@Body(). - Disk storage is temporary. The adapter removes the files after the response.
Static files
Section titled “Static files”- Content types come from a built-in table of common web types. The adapters
send other extensions as
application/octet-stream. - On Bun, a full response to a request with a
Rangeheader is sent withoutContent-Lengthabove 1 MiB.
- A
204preflight omitsContent-Length. methods: undefinedandoptionsSuccessStatus: undefineddo not fail the preflight.enableCors()reads static options once.allowCredentialsworks as an alias ofcredentials.
Cookies
Section titled “Cookies”res.cookie()/res.clearCookie()can also sign with Nest’scookies.secret, not only with thecookie-parsersecret.- A falsy
pathsends an emptyPath=instead of none. - Nest’s serializer rejects
sameSite: "none"andpartitionedwithoutsecure. - The
encodeoption throws.
Not supported
Section titled “Not supported”- Deno.
- GraphQL subscriptions (see the Apollo driver).