| 1 |
from fastapi import FastAPI, Path |
| 2 |
|
| 3 |
app = FastAPI() |
| 4 |
|
| 5 |
|
| 6 |
@app.get("/items/{item_id}") |
| 7 |
async def read_items(q: str, item_id: int = Path(title="The ID of the item to get")): |
| 8 |
results = {"item_id": item_id} |
| 9 |
if q: |
| 10 |
results.update({"q": q}) |
| 11 |
return results |