28 lines
538 B
Python
28 lines
538 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
router = APIRouter()
|
|
|
|
towns = [
|
|
"Phoenix",
|
|
"Tucson",
|
|
"Mesa",
|
|
"Chandler",
|
|
"Glendale",
|
|
"Scottsdale",
|
|
"Gilbert",
|
|
"Tempe",
|
|
"Peoria",
|
|
"Surprise"
|
|
]
|
|
|
|
@router.post("/open")
|
|
async def get_arizona_towns():
|
|
"""endpoint that returns list of town in arizona"""
|
|
if request.method != "POST":
|
|
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
|
|
|
return {
|
|
"method": "POST",
|
|
"_verb": "post",
|
|
"towns": towns
|
|
} |