34 lines
713 B
Python
34 lines
713 B
Python
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
|
|
} |