jeremydaly / lambda-api

Lightweight web framework for your serverless applications
https://serverless-api.com
MIT License
1.41k stars 125 forks source link

Automatic Compression #178

Closed AndrewBarba closed 3 years ago

AndrewBarba commented 3 years ago

Automatically compress responses based on the Accept-Encoding header:

const api = require('lambda-api')({
  compression: true
})
jeremydaly commented 3 years ago

Hey @AndrewBarba, thanks for your work on this. Adding the zlib library breaks the ZERO DEPENDENCY rule, plus the package has been deprecated because the functionality has been rolled into Node.js CORE: https://nodejs.org/dist/latest/docs/api/zlib.html

I'm going to work on refactoring this and merging it into the main branch without the extra dependency.

jeremydaly commented 3 years ago

FYI, moving this work into a new zlib branch. https://github.com/jeremydaly/lambda-api/tree/zlib

AndrewBarba commented 3 years ago

@jeremydaly I didn't add any deps, this is using zlib built into Node.js

AndrewBarba commented 3 years ago

Curious why you think I added a new dep in the first place. Is something off in the git diff?

jeremydaly commented 3 years ago

🤦‍♂️ Sorry about that! I just saw the require and my mind went right to a new dependency. I'll get this merged right now.

jeremydaly commented 3 years ago

This is failing on Travis because the node version is still at 8. 😬

Updating that now.