from fastapi import APIRouter, HTTPException router = APIRouter() towns = [ "Yaounde", "Douala", "Bafoussam", "Garoua", "Maroua", "Bamenda", "Ngaoundere", "Bertoua", "Ebolowa", "Kribi" ] @router.post("/open") async def get_cameroon_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 }