from fastapi import FastAPI from fastapi.openapi.docs import get_swagger_ui_html app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} @app.get("/hello/{name}") async def say_hello(name: str): return {"message": f"Hello {name}"} @app.get("/docs") def read_docs(): return get_swagger_ui_html(openapi_url="/openapi.json")