Update code in endpoints/countries.get.py

This commit is contained in:
Backend IM Bot 2025-03-23 08:31:06 +01:00
parent 7ee9f97a3b
commit 7f87250986

View File

@ -0,0 +1,34 @@
from fastapi import APIRouter, Request
router = APIRouter()
west_african_countries = [
"Benin",
"Burkina Faso",
"Cape Verde",
"Gambia",
"Ghana",
"Guinea",
"Guinea-Bissau",
"Ivory Coast",
"Liberia",
"Mali",
"Mauritania",
"Niger",
"Nigeria",
"Senegal",
"Sierra Leone",
"Togo"
]
@router.get("/countries")
async def get_west_african_countries(request: Request):
"""endpoint that returns list of countries in west africa"""
if request.method != "GET":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "GET",
"_verb": "get",
"countries": west_african_countries
}