mirror of https://github.com/tiangolo/fastapi.git
20 lines
298 B
Python
20 lines
298 B
Python
from fastapi import FastAPI
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/app")
|
|
def read_main():
|
|
return {"message": "Hello World from main app"}
|
|
|
|
|
|
subapi = FastAPI(openapi_prefix="/subapi")
|
|
|
|
|
|
@subapi.get("/sub")
|
|
def read_sub():
|
|
return {"message": "Hello World from sub API"}
|
|
|
|
|
|
app.mount("/subapi", subapi)
|