def mounted_api() -> Api: api = Api() api.register_component(MountedComponent) @api.route("/root-component") class RootView: async def on_get(self, req: Request, resp: Response, /, **kw) -> Response: try: use_component(RootComponent) except KeyError: return resp.set_status( HTTPStatus.NOT_FOUND).set_text("not found") return resp.set_status(HTTPStatus.OK).set_text("ok")
def store_async(api: Api): api.register_component(StoreAsync) return StoreAsync