mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-05 23:55:06 -04:00
📝 Update docs, add first tutorials
This commit is contained in:
13
docs/tutorial/src/all/tutorial013.py
Normal file
13
docs/tutorial/src/all/tutorial013.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from fastapi import FastAPI, Path
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/{item_id}")
|
||||
async def read_items(
|
||||
*, item_id: int = Path(..., title="The ID of the item to get", ge=1), q: str
|
||||
):
|
||||
results = {"item_id": item_id}
|
||||
if q:
|
||||
results.update({"q": q})
|
||||
return results
|
||||
Reference in New Issue
Block a user