mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-04 06:58:42 -05:00
📝 Move tutorial src files to top level docs
This commit is contained in:
13
docs/src/path_params_numeric_validations/tutorial002.py
Normal file
13
docs/src/path_params_numeric_validations/tutorial002.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from fastapi import FastAPI, Path
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/{item_id}")
|
||||
async def read_items(
|
||||
q: str, item_id: int = Path(..., title="The ID of the item to get")
|
||||
):
|
||||
results = {"item_id": item_id}
|
||||
if q:
|
||||
results.update({"q": q})
|
||||
return results
|
||||
Reference in New Issue
Block a user