📝 Add first tutorial src files

This commit is contained in:
Sebastián Ramírez
2018-12-13 21:05:15 +04:00
parent 948a39af95
commit 7da0233e35
68 changed files with 1404 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
from fastapi import FastAPI, Query
app = FastAPI()
@app.get("/items/")
async def read_items(
q: str = Query(
None, title="Query string", min_length=3, max_length=50, regex="^fixedquery$"
)
):
results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
if q:
results.update({"q": q})
return results