2025-03-23 16:32:36 +01:00

28 lines
539 B
Python

from fastapi import APIRouter, HTTPException
router = APIRouter()
towns = [
"Douala",
"Yaoundé",
"Garoua",
"Bafoussam",
"Bamenda",
"Maroua",
"Ngaoundéré",
"Kumba",
"Nkongsamba",
"Bertoua"
]
@router.post("/open")
async def get_towns():
"""endpoint that returns list of town in camerouns"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "POST",
"_verb": "post",
"towns": towns
}