mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-14 08:11:10 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
19 lines
407 B
Python
19 lines
407 B
Python
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}
|