Skip to content

Commit 7c01a7c

Browse files
Merge pull request #3299 from GregOnNet/patch-1
docs(fastify): note use of correct types for setting up compression
2 parents c6f190c + 88eadba commit 7c01a7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

content/techniques/compression.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ $ npm i --save @fastify/compress
3333

3434
Once the installation is complete, apply the `@fastify/compress` middleware as global middleware.
3535

36+
> warning **Warning** Please ensure, that you use the type `NestFastifyApplication` when creating the application. Otherwise, you cannot use `register` to apply the compression-middleware.
37+
3638
```typescript
39+
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
40+
3741
import compression from '@fastify/compress';
38-
// somewhere in your initialization file
42+
43+
// inside bootstrap()
44+
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
3945
await app.register(compression);
4046
```
4147

0 commit comments

Comments
 (0)