gzip response
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-06 12:57:28 +03:30
parent d4e76a2ab4
commit c6c9812fd6
3 changed files with 223 additions and 8 deletions
+13
View File
@@ -3,8 +3,10 @@ import { AppModule } from './app.module';
import { ConfigService } from '@nestjs/config';
import { Logger, ValidationPipe } from '@nestjs/common';
import { getSwaggerConfig } from './config/swagger.config';
import compress from '@fastify/compress';
import multipart from '@fastify/multipart';
import fastifyCookie from '@fastify/cookie';
import * as zlib from 'zlib';
// 👈 Import the Fastify application type
import { type NestFastifyApplication, FastifyAdapter } from '@nestjs/platform-fastify';
@@ -23,6 +25,17 @@ async function bootstrap() {
{ logger: ['error', 'warn', 'log', 'debug', 'verbose'] },
);
await app.register(compress, {
global: true,
encodings: ['br', 'gzip', 'deflate'],
threshold: 1024,
brotliOptions: {
params: {
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,
},
},
});
await app.register(fastifyCookie);
await app.register(multipart);