Open andreastedile opened 2 years ago
Off the top of my head, I don't know if Pistache currently supports this use case, but I can see it being very useful. If Pistache does not have this type of API, you are free to submit a pull requests to add it. Please add proper unit tests to cover your changes.
I think this is very useful, I did a pull request: #1085
In the past I have used Java Servlets (now Jarkarta Servlets). With Servlets, I could set a "request attribute". To better explain what a request attribute is, it is easier if I provide a use case.
When the execution flow reaches the actual handler, one could do as follows:
The advantage of this is that any handler that needs to do something with the
User
entity does not need to repeat the logic of checking whether the user exists and is authenticated (separation of concerns).Is it possible to do something like this in Pistache? Thank you! :smile: