Skip to content

Commit 76d4fef

Browse files
docs: update migration guide
1 parent d15fb5c commit 76d4fef

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

content/migration.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,34 @@ forRoutes('{*splat}'); // <-- This will work in Express v5
5656

5757
Note that `{{ '{' }}*splat&#125;` is a named wildcard that matches any path including the root path. Outer braces make path optional.
5858

59+
#### Query parameters parsing
60+
61+
> info **Note** This change only applies to Express v5.
62+
63+
In Express v5, query parameters are no longer parsed using the `qs` library by default. Instead, the `simple` parser is used, which does not support nested objects or arrays.
64+
65+
As a result, query strings like these:
66+
67+
```plaintext
68+
?filter[where][name]=John&filter[where][age]=30
69+
?item[]=1&item[]=2
70+
```
71+
72+
will no longer be parsed as expected. To revert to the previous behavior, you can configure Express to use the `extended` parser (the default in Express v4) by setting the `query parser` option to `extended`:
73+
74+
```typescript
75+
import { NestFactory } from '@nestjs/core';
76+
import { NestExpressApplication } from '@nestjs/platform-express';
77+
import { AppModule } from './app.module';
78+
79+
async function bootstrap() {
80+
const app = await NestFactory.create<NestExpressApplication>(AppModule); // <-- Make sure to use <NestExpressApplication>
81+
app.set('query parser', 'extended'); // <-- Add this line
82+
await app.listen(3000);
83+
}
84+
bootstrap();
85+
```
86+
5987
#### Fastify v5
6088

6189
Fastify v5 was released in 2024 and is now the default version integrated into NestJS 11. This update should be seamless for most users; however, Fastify v5 introduces a few breaking changes, though these are unlikely to affect the majority of NestJS users. For more detailed information, refer to the [Fastify v5 migration guide](https://fastify.dev/docs/v5.1.x/Guides/Migration-Guide-V5/).
@@ -112,6 +140,12 @@ A -> B -> C
112140

113141
> info **Hint** Global modules are treated as if they depend on all other modules. This means that global modules are initialized first and destroyed last.
114142
143+
#### Middleware registration order
144+
145+
In NestJS v11, the behavior of middleware registration has been updated. Previously, the order of middleware registration was determined by the topological sort of the module dependency graph, where the distance from the root module defined the order of middleware registration, regardless of whether the middleware was registered in a global module or a regular module. Global modules were treated like regular modules in this respect, which led to inconsistent behavior, especially when compared to other framework features.
146+
147+
From v11 onwards, middleware registered in global modules is now **executed first**, regardless of its position in the module dependency graph. This change ensures that global middleware always runs before any middleware from imported modules, maintaining a consistent and predictable order.
148+
115149
#### Cache module
116150

117151
The `CacheModule` (from the `@nestjs/cache-manager` package) has been updated to support the latest version of the `cache-manager` package. This update brings a few breaking changes, including a migration to [Keyv](https://keyv.org/), which offers a unified interface for key-value storage across multiple backend stores through storage adapters.

0 commit comments

Comments
 (0)