Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add DishkaRouter for integrations/litestar.py #331

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

chesnokpeter
Copy link

Similar to fastapi, i added DishkaRouter to get each handler to not need to hang @inject on every handler

from dishka.integrations.litestar import (
    FromDishka,
    LitestarProvider,
    inject,
    setup_dishka,
    DishkaRouter,
)
    
@post('/')
async def general(gateway: FromDishka[Gateway]) -> Response:
    ...

r = DishkaRouter('', route_handlers=[general])

def create_app() -> Litestar:
    app = Litestar(route_handlers=[r])
    setup_dishka(container, app)

.venv/

uv.lock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to PR
anyway, we do not use lock here as we develop library

@Tishka17
Copy link
Member

Tishka17 commented Jan 7, 2025

  • Tests
  • Can in be used with websockets?
  • Can it be used with nested routers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants