mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-06 10:36:39 +00:00
10 lines
219 B
Python
10 lines
219 B
Python
from fastapi import FastAPI
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/{item_id}")
|
|
async def read_item(item_id: str, q: str | None = None):
|
|
if q:
|
|
return {"item_id": item_id, "q": q}
|
|
return {"item_id": item_id}
|