falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 937 forks source link

ASGI mount #1950

Open dantownsend opened 3 years ago

dantownsend commented 3 years ago

Hi, I'm really glad to see Falcon supporting ASGI - great job!

In some other ASGI frameworks (for example FastAPI, Starlette and BlackSheep) there is the ability to mount other ASGI apps at a certain route. For example:

asgi_app = falcon.asgi.App()
asgi_app.mount('/admin/', some_other_asgi_app)

It's nice because you can include third party ASGI apps within your own app - in my case it's Piccolo admin. It also lets you compose your app in interesting ways, by making it consist of smaller sub apps.

I wonder if you'd consider this in a future version of Falcon? Or if it's currently possible, and I'm unaware.

If you feel it's out of scope, please feel free to close this issue. Thanks.

vytas7 commented 3 years ago

Hi @dantownsend ! Yes, we have already been discussing the ability to mount other WSGI/ASGI apps, partially to address a common feature request to emulate "blueprints" with Falcon's own apps, as well as mounting any generic app.

See also the routing discussion: https://github.com/falconry/falcon/discussions/1818, as well as https://github.com/falconry/falcon/issues/1894.

I don't think we have a dedicated issue for this feature, so yours could serve as a starting point for the ASGI flavour :wink: