NestJS platform-node (12.3): The Adapter That Reorders Your Routes
A team upgrades @nestjs/core and swaps NestFactory.create(AppModule) for NestFactory.create(AppModule, new NodeAdapter()) — NestJS's brand-new, Express-free HTTP adapter, chasing the ~50% throughput bump its author measured against Express. Everything passes locally. In production, a request to /users/Me — a stray capital from an old mobile build nobody's shipped in a year — starts returning 404…
A team upgraded @nestjs/core, replacing NestFactory.create(AppModule) with NestFactory.create(AppModule, new NodeAdapter()). This new, Express-free HTTP adapter, @nestjs/platform-node, was measured to improve throughput by ~50% compared to Express. However, after the upgrade, a request to /users/Me, which was previously returning the profile, started returning 404. The issue wasn't routing or controller changes; it was the adapter enforcing a case-sensitive routing behavior Express didn't have.
@nestjs/platform-node is introduced in NestJS 12.3.0, with its own unique assumptions about routing compared to Express. This article explains how the new adapter matches routes, the case-sensitivity trap, and whether adopting it is beneficial before it becomes the default in v13.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to