-
Notifications
You must be signed in to change notification settings - Fork 565
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
Lifecycle hook support #491
Comments
I'm positive. This technique can be implemented with very little overhead (see Fastify). However I would not do global, only per-client and per-pool. |
@mcollina Can you point out places in fastify code you would recommend to use as reference? Also should I go for full-blown plugin style as fastify does, or implement minimal useful subset of features? |
I would go with minimal features. Here is the hooks implementation: https://github.com/fastify/fastify/blob/master/lib/hooks.js |
Thanks a lot! |
@mcollina BTW, there is no |
No only LTS versions. |
I would like to suggest the following signature for extending Dispatchers
This way, we can reduce a list of DispatchExtenders when calling dispatch on each dispatcher.
For example, we can wrap the existing RedirectHandler like this:
We can also handle caching as per #1146 using a decorator. The decorator would simply call then innerHandler with the result, then pass a RequestHandler with an already aborted abort signal, so that the Dispatcher will ignore that request. |
It would be helpful to support pre/post-processing of requests/responses. Some of the use-cases that I see are:
Ideally this feature should come with a certain level of granularity, so that it is either possible to set lifecycle hooks both per Client or globally.
If this is accepted, I can work on implementation.
The text was updated successfully, but these errors were encountered: