from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/") def root(): return {"Hello": "World"} @app.get("/api") def root(): return {"Hello": "API!"}