proposal: split hooks methods in mixins to maximize atomicity and type safety #101
Closed
Description
What is your proposal
I propose splitting the hooks methods into mixins to ensure a high level of atomicity and type safety in the application.
Right now, when adding a hook to a Serinus application, the framework is not aware of what methods have been implemented and iterates through all of them. This proposal aims to make the hook system more robust.
Also since some methods are shared with the Route interface they can be unified to reduce code duplication.
Proposed mixins and methods that will expose:
OnRequestResponse
:onRequest
,onResponse
;OnBeforeHandle
:beforeHandle
(valid also for route);OnAfterHandle
:afterHandle
(valid also for route);OnTransform
:transform
(valid only for route);
We reduce the overhead of the request handler because it won't have to iterate through all the hooks but only through the hooks with that specific mixin.
Metadata
Assignees
Projects
Status
Closed