-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Description
Do this:
main_app = FastAPI()
sub_api = FastAPI()
...
main_app.router.routes.append(Mount('/subapi', app=sub_api))
sub_api will correctly serve ever /subapi -- docs, methods, all that. However, the docs will still look for /openapi.json (absolute link) when trying to load the openapi spec. Additionally, the spec will not be adjusted to have the correct links, relative to where the module is mounted.
Perhaps this is a corner use case, but a lot of apps might have different collections of routes mounted in different subpaths.