Skip to content

Commit b44045b

Browse files
committed
docs(middlewares): Add hint for global middlewares and DI
Based on this issue comment: nestjs/nest#543 (comment) Thanks to https://github.com/felixhayashi for proposing this change.
1 parent 39b6837 commit b44045b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/middlewares.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,5 @@ const app = await NestFactory.create(AppModule);
241241
app.use(logger);
242242
await app.listen(3000);
243243
```
244+
245+
> info **Hint** Accessing the DI container in a global middleware is not possible. You need to use a functional middleware instead when using `app.use()`. Alternatively, you can use a class middleware and consume it with `.forRoutes('*')`.

0 commit comments

Comments
 (0)