28 lines
539 B
Python
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
|
|
} |