28 lines
564 B
Python
28 lines
564 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
router = APIRouter()
|
|
|
|
towns_in_arizona = [
|
|
"Phoenix",
|
|
"Tucson",
|
|
"Mesa",
|
|
"Chandler",
|
|
"Glendale",
|
|
"Scottsdale",
|
|
"Gilbert",
|
|
"Tempe",
|
|
"Peoria",
|
|
"Surprise"
|
|
]
|
|
|
|
@router.post("/open")
|
|
async def get_towns_in_arizona():
|
|
"""Endpoint that 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
|
|
} |