feat: add gzip compression middleware for API responses (#70)#656
Conversation
|
@cyber-excel10 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@cyber-excel10 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
995be33 to
f9ffd43
Compare
Notes on failing CI checksI investigated every failing check on this PR and confirmed (via
Happy to file separate issues for any of these if useful... I wanted to |
Closes #70
Changes
compressionmiddleware toapi/src/app.ts, registered earlyin the middleware chain (right after
helmet)threshold: 1024so responses under 1KB aren't compressed(overhead would outweigh the benefit)
compressionand@types/compressionto dependenciessrc/__tests__/compression.test.tsverifying:content-encoding: gzipwhen theclient sends
Accept-Encoding: gzipTesting
All 3 new tests pass (
NODE_ENV=development npx jest src/__tests__/compression.test.ts). Also manually verified with curlagainst
/api/v1/openapi.json.Notes
While testing, i found two pre-existing issues unrelated to this change
(confirmed present on
mainviagit stashbefore this PR):NODE_ENV=testfails the app's config validator,breaking most test suites unless
NODE_ENVis set explicitly.tsc --noEmitreports ~195 pre-existing type errors across thecodebase (unrelated files) — confirmed this PR introduces none.
Happy to file separate issues for these if useful.