ASGI¶
TODO
Add a framework-agnostic end-to-end example showing how to mount the mplbed application, retain the native application context, and generate route URLs. Until then, prefer a framework-specific integration when one is available.
The lower-level ASGI API provides middleware and context helpers used by the framework integrations.
API reference¶
- class mplbed.asgi.MplbedMiddleware(default_app, *, prefix, app=None, app_kwargs=None, manage_routing=True, native_app=None)
Bases:
objectASGI middleware to sets up routing and ensures context the correct context is available so that the integrations work correctly.
- mplbed.asgi.get_native_app()
Get the native app from the current context.
- Returns:
The native app, or None if not set.
- Return type:
Any
- mplbed.asgi.get_asgi_app()
Get the ASGI app from the current context.
- Returns:
The ASGI app, or None if not set.
- Return type:
ASGI3Application | None
- mplbed.asgi.url_path_for(name, **path_params)
Get the URL path for a given route name and parameters.