feat: api response compression (#17878)

This commit is contained in:
Zack Pollard 2025-04-28 14:54:11 +01:00 committed by GitHub
parent e6c575c33e
commit 460d594791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 70 additions and 0 deletions

View file

@ -1,6 +1,7 @@
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { json } from 'body-parser';
import compression from 'compression';
import cookieParser from 'cookie-parser';
import { existsSync } from 'node:fs';
import sirv from 'sirv';
@ -60,6 +61,7 @@ async function bootstrap() {
);
}
app.use(app.get(ApiService).ssr(excludePaths));
app.use(compression());
const server = await (host ? app.listen(port, host) : app.listen(port));
server.requestTimeout = 24 * 60 * 60 * 1000;