1from fastapi import FastAPI
2from typing import Optional
3
4app = FastAPI()
5
6
7@app.get("/")
8def read_root():
9 return {"Hello": "World"}
10
11
12@app.get("/items/{item_id}")
13def read_item(item_id: int, q: Optional[str] = None):
14 return {"item_id": item_id, "q": q}
15