19 lines
362 B
Python
19 lines
362 B
Python
from fastapi import APIRouter
|
|
|
|
router = APIRouter(prefix="/example", tags=["example"])
|
|
|
|
|
|
@router.get("/")
|
|
async def list_items():
|
|
return {"items": ["a", "b", "c"]}
|
|
|
|
|
|
@router.get("/{item_id}")
|
|
async def get_item(item_id: int):
|
|
return {"id": item_id, "name": f"item_{item_id}"}
|
|
|
|
|
|
@router.post("/")
|
|
async def create_item():
|
|
return {"status": "created"}
|