pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
407 B
18 lines
407 B
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/users/", tags=["users"])
|
|
async def read_users():
|
|
return [{"username": "Rick"}, {"username": "Morty"}]
|
|
|
|
|
|
@router.get("/users/me", tags=["users"])
|
|
async def read_user_me():
|
|
return {"username": "fakecurrentuser"}
|
|
|
|
|
|
@router.get("/users/{username}", tags=["users"])
|
|
async def read_user(username: str):
|
|
return {"username": username}
|
|
|