from fastapi import APIRouter, HTTPException router = APIRouter() towns = [ "Memphis", "Nashville", "Knoxville", "Chattanooga", "Clarksville", "Murfreesboro", "Franklin", "Jackson", "Johnson City", "Bartlett" ] @router.post("/tenants") async def get_tennessee_towns(): """Returns list of towns in Tennessee""" if request.method != "POST": raise HTTPException(status_code=405, detail="Method Not Allowed") return { "method": "POST", "_verb": "post", "towns": towns }