jupyter-server / jupyverse

A Jupyter server based on FastAPI :rocket:
https://jupyter-server.github.io/jupyverse
Other
240 stars 28 forks source link

mount jupyverse in fastapi app #429

Open HaoXuAI opened 2 months ago

HaoXuAI commented 2 months ago

Problem

Is there a way to mount jupyvers APIs into another fastapi app? e.g, I have something like:

app = FastAPI()

And I started the server with gunicorn server:app..., is there a way to just mount all jupyverse in the app without starting it with the asphalt?

Proposed Solution

the current way I'm doing is:

# Create the app.
app = App()
jupyverse_app = App(app.api, "jupyverse")

frontend_config = FrontendConfig()
auth_config = _AuthConfig()

auth = auth_factory(jupyverse_app, auth_config, frontend_config)

But feels like too hacking.

Additional context