For convenience and flexibility, the signatures of the handler functions should be modified for several key reasons:
To prevent the direct return of an external dependency as a response to the request.
This limits the bounds we can impose on the return values.
In the event of breaking changes within the dependency, we would be forced to rewrite the handler functions to accommodate the new changes.
If we decide to transition to different API types, such as from JSON to gRPC, this would necessitate significant modifications in the handler functions.
To facilitate the collection and dispatch logic within the handlers.
By decoupling in this manner, the handler functions need only focus on the request handling logic, with the outcome being delegated to a separate domain, enhancing flexibility.
For convenience and flexibility, the signatures of the handler functions should be modified for several key reasons: