def asgi_app(
    app: ASGIApp, *, path: str = "/", name: str | None = None
) -> t.Callable[[R], R]:
    """Mount an ASGI app to the service.

    Args:
        app: The ASGI app to be mounted.
        path: The path to mount the app.
        name: The name of the app.
    """

    from ._internals import make_fastapi_class_views
    from .service import Service

    def decorator(obj: R) -> R:
        lazy_fastapi = LazyType["FastAPI"]("fastapi.FastAPI")

        if isinstance(obj, Service):
            obj.mount_asgi_app(app, path=path, name=name)
            if lazy_fastapi.isinstance(app):
                make_fastapi_class_views(obj.inner, app)
        else:
            mount_apps = getattr(obj, "__bentoml_mounted_apps__", [])
            mount_apps.append((app, path, name))
            setattr(obj, "__bentoml_mounted_apps__", mount_apps)
            if lazy_fastapi.isinstance(app):
                make_fastapi_class_views(obj, app)
        return obj

    return decorator
Mount an ASGI app to the service.

Args:
app: The ASGI app to be mounted.
path: The path to mount the app.
name: The name of the app.
src/_bentoml_sdk/decorators.py