How to compress procedure response
I have one trpc procedure which has 40 mb response. I would like to compress this. How can I compress one procedure call in trpc. Or even better have compression for all trpc procedures above some threshold. Is it possible or I have to create separate api endpoint out of trpc context.
I’m using nextjs with custom express server.
1 Reply
Depends on your adapter, but with AWS Lambdas I've done exactly that, I intercept the request + response, check the size, and gzip before responding if above a certain threshold
Additionally some frameworks might support this using their own middlewares system. I would believe express for instance would support that