drogonframework / drogonframework/drogon
Dynamically define what filter I want to use
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
**Is your feature request related to a problem? Please describe.**
I am using drogon in a base docker image that I use for various projects, and I often need to create a controller which sole purpose is to serve specific data, and ideally its routes are filtered (using a drogon filter).
I have created a base controller that I can reuse in different projects, but I am forced to specify statically (with a string) the name of the filter I want to use on its routes, and I am not aware of any way to dynamically determine the wanted filter when creating said controller.
The controller is not auto-generated because I need to pass arguments to it.
**Describe the solution you'd like**
A great solution would be to be able to specify the filter I want to use (either in string format or in templating) dynamically. I didn't find much ways to pass a filter to a route besides specifying a string containing the name of the filter class when adding a route, perhaps there is another way to do it which I am unaware of?
Also, being able to register a filter with a chosen string id would be nice
**Describe alternatives you've considered**
For now, I am either making sure the filter I use is always named the same, or copying the base controller with another filter in the route adding
Contributor guide
Assessment
This issue has not been assessed yet.