-
Notifications
You must be signed in to change notification settings - Fork 686
Open
Description
First: Thanks for this amazing package!
FastAPI supports Sub-Applications / Mounts, see here.
In this case, you have separate SwaggerUIs. For instance:
import logging
import uvicorn
from fastapi import FastAPI
logging.basicConfig(format="%(asctime)s %(message)s")
logging.getLogger().setLevel(logging.INFO)
logger = logging.getLogger(__name__)
app = FastAPI()
@app.get("/app")
def read_main():
return {"message": "Hello World from main app"}
subapi = FastAPI()
@subapi.get("/sub")
def read_sub():
return {"message": "Hello World from sub API"}
app.mount("/subapi", subapi)
if __name__ == "__main__":
logger.info("Starting HTTP server ...")
uvicorn.run(app, reload=False, log_config=None)
In this case, you can reach the SwaggerUIs under the following URLs:
Is it possible to use FastAPI-MCP, and expose all endpoints (including those from the sub-apps)? Alternatively, is it possible to just expose the endpoints from any of the sub-apps?
Thank you :)
Metadata
Metadata
Assignees
Labels
No labels