rodi icon indicating copy to clipboard operation
rodi copied to clipboard

How could someone use rodi in web frameworks other than BlackSheep

Open aeb-dev opened this issue 2 years ago • 3 comments

I am trying to integrate rodi with FastAPI but I am not sure how should I approach to the problem.

Is there any example? Flask or any other web framework example would also help

aeb-dev avatar Jan 07 '24 13:01 aeb-dev

@aeb-dev I'm creating a library using Rodi and FastAPI. Although it might be overkill for what you're asking, you can see how I implemented and combined them here if you have the time to go through the code haha:

https://github.com/lucas-labs/pest/blob/master/pest/core/module.py

lucas-labs avatar Feb 08 '24 15:02 lucas-labs

Thank you @lucas-labs. We actually inspired from your project to achieve what we want. Thanks for the idea!

aeb-dev avatar Feb 12 '24 13:02 aeb-dev

We integrated Rodi into FastAPI via a custom middleware, and to Strawberry via a SchemaExtension. To not interfere with either framework we use wrappers to remove the autowired parameters from what the frameworks see. Strawberry specifically isn't friendly to this process.

StummeJ avatar Feb 28 '24 03:02 StummeJ