mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-13 19:38:34 -04:00
📝 Add tutorials python src files
This commit is contained in:
18
docs/tutorial/src/tutorial74.py
Normal file
18
docs/tutorial/src/tutorial74.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/users/")
|
||||
async def read_users():
|
||||
return [{"username": "Foo"}, {"username": "Bar"}]
|
||||
|
||||
|
||||
@router.get("/users/{username}")
|
||||
async def read_user(username: str):
|
||||
return {"username": username}
|
||||
|
||||
|
||||
@router.get("/users/me")
|
||||
async def read_user_me():
|
||||
return {"username": "fakecurrentuser"}
|
||||
Reference in New Issue
Block a user