From afb4c60537215462938f2be441a6ba8cea30c651 Mon Sep 17 00:00:00 2001 From: mai Date: Wed, 6 Nov 2024 18:47:40 -0500 Subject: [PATCH] add compression middleware --- backend/package.json | 2 ++ backend/src/server.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/backend/package.json b/backend/package.json index eeac23cf..2e43dbfb 100644 --- a/backend/package.json +++ b/backend/package.json @@ -33,9 +33,11 @@ "dependencies": { "@aws-sdk/client-s3": "^3.685.0", "@supabase/supabase-js": "^2.45.3", + "@types/compression": "^1.7.5", "@types/express-session": "^1.18.0", "@types/supertest": "^6.0.2", "aws-sdk": "^2.1691.0", + "compression": "^1.7.5", "connect-mongo": "^5.1.0", "dotenv": "^16.4.5", "express": "^4.19.2", diff --git a/backend/src/server.ts b/backend/src/server.ts index 12627d14..65e971c9 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -15,6 +15,7 @@ import { resolve } from 'path'; import dotenv from 'dotenv'; import { serve, setup } from 'swagger-ui-express'; import swaggerJsDoc from 'swagger-jsdoc'; +import compression from 'compression'; dotenv.config({ path: resolve(__dirname, '../.env') }); @@ -46,6 +47,8 @@ const spec = swaggerJsDoc(options); export const startServer = () => { initializeLogging(); + router.use(compression({ threshold: 0 })); + router.use(sessionMiddleware); router.use('/api-docs', serve, setup(spec));