mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-25 03:09:50 -04:00
📝 Update docs, add first tutorials
This commit is contained in:
1 parent
400a4a99af
commit
093bb4cd19
90 files changed
+518
-27
No files matched your search
@@ -0,0 +1,17 @@
|
||||
from fastapi import FastAPI
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Item(BaseModel):
|
||||
name: str
|
||||
description: str = None
|
||||
price: float
|
||||
tax: float = None
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item):
|
||||
return {"item_id": item_id, **item.dict()}
|
||||
Reference in new issue
Block a user