-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to compress the output of an ejs template rendered reply without set the global flag #89
Comments
I think this is better solved in the fastify-compress module, adding support for compressing a single route. This is already possible given the internals of the framework, we are only missing support in fastify-compress. |
It would be great yes please! |
Hello @mcollina |
If somebody would like to work on it, yes! |
You could try to implement it 💪 this plugin: https://github.com/fastify/fastify-rate-limit has this kind of feature: global and/or per-route usage, you may get some inspiration from it! |
Is there a way to hook into onSend per route? The last per route option in the lifecycle right now is preSerialization so any thoughts on how this could work? |
No, right now there is not this option, but it should easy to add here:
Good point, we should add to fastify that parameter, then this issue can be implemented |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hello
i'm doing something like that :
reply.view('/src/templates/hello.ejs', { hello: 'world' })
I'd like to compress the output of my ejs template, .compress will not work directly and I don't want to activate the global flag
Do you know how can I do that ? can we enrich the component with a compressOnSend method to accept to be chained and activate the onsend hook ?
reply.view('/src/templates/hello.ejs', { hello: 'world' }).compressOnSend()
Thanks
The text was updated successfully, but these errors were encountered: