APIRouter
from fastapi import APIRouter
router = APIRouter()
@router.get('/users', tags=['users'])
async def read_users():
...
@router.get("/users/me", tags=["users"])
async def read_user_me():
...
Python
복사
APIRouter()의 매개변수로 prefix나 tags, dependencies, responses를 한번에 설정할 수 있음
router = APIRouter(
prefix="/items",
tags=["items"],
dependencies=[],
responses={404: {"description": "Not found"}},
)
Python
복사