You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/migration.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,34 @@ forRoutes('{*splat}'); // <-- This will work in Express v5
56
56
57
57
Note that `{{ '{' }}*splat}` is a named wildcard that matches any path including the root path. Outer braces make path optional.
58
58
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`:
const app =awaitNestFactory.create<NestExpressApplication>(AppModule); // <-- Make sure to use <NestExpressApplication>
81
+
app.set('query parser', 'extended'); // <-- Add this line
82
+
awaitapp.listen(3000);
83
+
}
84
+
bootstrap();
85
+
```
86
+
59
87
#### Fastify v5
60
88
61
89
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
112
140
113
141
> 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.
114
142
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
+
115
149
#### Cache module
116
150
117
151
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