def __call__(self) -> ASGIApp:
        """Run the backend api instance.

        Raises:
            ValueError: If the app has not been initialized.

        Returns:
            The backend api.
        """
        # For py3.9 compatibility when redis is used, we MUST add any decorator pages
        # before compiling the app in a thread to avoid event loop error (REF-2172).
        self._apply_decorated_pages()

        compile_future = concurrent.futures.ThreadPoolExecutor(max_workers=1).submit(
            self._compile
        )

        def callback(f: concurrent.futures.Future):
            # Force background compile errors to print eagerly
            return f.result()

        compile_future.add_done_callback(callback)
        # Wait for the compile to finish to ensure all optional endpoints are mounted.
        compile_future.result()

        if not self._api:
            msg = "The app has not been initialized."
            raise ValueError(msg)

        if self._cached_fastapi_app is not None:
            asgi_app = self._cached_fastapi_app
            asgi_app.mount("", self._api)
            App._add_cors(asgi_app)
        else:
            asgi_app = self._api

        if self.api_transformer is not None:
            api_transformers: Sequence[Starlette | Callable[[ASGIApp], ASGIApp]] = (
                [self.api_transformer]
                if not isinstance(self.api_transformer, Sequence)
                else self.api_transformer
            )

            for api_transformer in api_transformers:
                if isinstance(api_transformer, Starlette):
                    # Mount the api to the fastapi app.
                    App._add_cors(api_transformer)
                    api_transformer.mount("", asgi_app)
                    asgi_app = api_transformer
                else:
                    # Transform the asgi app.
                    asgi_app = api_transformer(asgi_app)

        top_asgi_app = Starlette(lifespan=self._run_lifespan_tasks)
        top_asgi_app.mount("", asgi_app)
        App._add_cors(top_asgi_app)

        return top_asgi_app
Run the backend api instance.

        Raises:
            ValueError: If the app has not been initialized.

        Returns:
            The backend api.
        
reflex/app.py