diff --git a/endpoints/call.post.py b/endpoints/call.post.py new file mode 100644 index 0000000..3e2a0eb --- /dev/null +++ b/endpoints/call.post.py @@ -0,0 +1,28 @@ +from fastapi import APIRouter, HTTPException + +router = APIRouter() + +towns_in_arizona = [ + "Phoenix", + "Tucson", + "Mesa", + "Chandler", + "Glendale", + "Scottsdale", + "Gilbert", + "Tempe", + "Peoria", + "Surprise" +] + +@router.post("/call", status_code=200) +async def get_towns_in_arizona(): + """Returns list of towns in Arizona""" + if request.method != "POST": + raise HTTPException(status_code=405, detail="Method Not Allowed") + + return { + "method": "POST", + "_verb": "post", + "towns": towns_in_arizona + } \ No newline at end of file