📝 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,8 @@
from fastapi import FastAPI
my_awesome_api = FastAPI()
@my_awesome_api.get("/")
async def root():
return {"message": "Hello World"}

View File

@@ -0,0 +1,8 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
return {"message": "Hello World"}

View File

@@ -0,0 +1,11 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/users/{user_id}/items/{item_id}")
async def read_user_item(
user_id: int, item_id: str, needy: str
):
item = {"item_id": item_id, "owner_id": user_id, "needy": needy}
return item

View File

@@ -1,17 +0,0 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/users/{user_id}/items/{item_id}")
async def read_user_item(
user_id: int, item_id: str, needy: str, q: str = None, short: bool = False
):
item = {"item_id": item_id, "owner_id": user_id, "needy": needy}
if q:
item.update({"q": q})
if not short:
item.update(
{"description": "This is an amazing item that has a long description"}
)
return item