server: add compression

This commit is contained in:
fantasticit 2022-05-22 10:32:20 +08:00
parent 88c2769fa6
commit f6c5e72126
2 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,7 @@
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"compression": "^1.7.4",
"date-fns": "^2.28.0",
"express": "^4.17.2",
"express-rate-limit": "^6.2.0",

View File

@ -3,6 +3,7 @@ import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@pipes/validation.pipe';
import { HttpResponseTransformInterceptor } from '@transforms/http-response.transform';
import * as compression from 'compression';
import * as express from 'express';
import helmet from 'helmet';
@ -16,6 +17,7 @@ async function bootstrap() {
const port = config.get('server.port') || 5002;
app.enableCors();
app.use(compression());
app.use(helmet());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));