mirror of https://github.com/fantasticit/think.git
server: add compression
This commit is contained in:
parent
88c2769fa6
commit
f6c5e72126
|
@ -35,6 +35,7 @@
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.13.2",
|
"class-validator": "^0.13.2",
|
||||||
|
"compression": "^1.7.4",
|
||||||
"date-fns": "^2.28.0",
|
"date-fns": "^2.28.0",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"express-rate-limit": "^6.2.0",
|
"express-rate-limit": "^6.2.0",
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { ConfigService } from '@nestjs/config';
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { ValidationPipe } from '@pipes/validation.pipe';
|
import { ValidationPipe } from '@pipes/validation.pipe';
|
||||||
import { HttpResponseTransformInterceptor } from '@transforms/http-response.transform';
|
import { HttpResponseTransformInterceptor } from '@transforms/http-response.transform';
|
||||||
|
import * as compression from 'compression';
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import helmet from 'helmet';
|
import helmet from 'helmet';
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ async function bootstrap() {
|
||||||
const port = config.get('server.port') || 5002;
|
const port = config.get('server.port') || 5002;
|
||||||
|
|
||||||
app.enableCors();
|
app.enableCors();
|
||||||
|
app.use(compression());
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
Loading…
Reference in New Issue