diff --git a/endpoints/countries.get.py b/endpoints/countries.get.py new file mode 100644 index 0000000..69478cf --- /dev/null +++ b/endpoints/countries.get.py @@ -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 + } \ No newline at end of file