📝 Update docs, add first tutorials

This commit is contained in:
Sebastián Ramírez
2018-12-14 14:27:02 +04:00
parent 400a4a99af
commit 093bb4cd19
90 changed files with 518 additions and 27 deletions

View File

@@ -0,0 +1,26 @@
from fastapi import FastAPI, Path
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
@app.put("/items/{item_id}")
async def update_item(
*,
item_id: int = Path(..., title="The ID of the item to get", ge=0, le=1000),
q: str,
item: Item = None,
):
results = {"item_id": item_id}
if q:
results.update({"q": q})
if item:
results.update({"item": item})
return results