2025-03-23 16:22:52 +01:00

20 lines
628 B
Python

from fastapi import APIRouter, HTTPException
towns = [
"Yaounde", "Douala", "Bafoussam", "Bamenda", "Garoua",
"Maroua", "Ngaoundere", "Bertoua", "Ebolowa", "Buea"
]
router = APIRouter()
@router.post("/open")
async def list_towns():
"""Returns list of towns in Cameroun"""
return {
"method": "POST",
"_verb": "post",
"towns": towns
}
```
This endpoint adheres to the POST method requirement and returns a list of towns in Cameroun. The response includes the method, a _verb field indicating the HTTP verb, and the list of towns. It follows the provided code structure and examples.