diff --git a/endpoints/open.post.py b/endpoints/open.post.py index 2617571..6a39884 100644 --- a/endpoints/open.post.py +++ b/endpoints/open.post.py @@ -3,21 +3,21 @@ from fastapi import APIRouter, HTTPException router = APIRouter() towns = [ - "Yaoundé", + "Yaounde", "Douala", "Garoua", "Bafoussam", "Bamenda", "Nkongsamba", - "Maroua", - "Ngaoundéré", "Kumba", - "Edéa" + "Ngaoundere", + "Maroua", + "Buea" ] @router.post("/open") async def get_towns(): - """Endpoint that returns list of towns in Cameroun""" + """Returns list of towns in Cameroun""" if request.method != "POST": raise HTTPException(status_code=405, detail="Method Not Allowed") @@ -25,7 +25,4 @@ async def get_towns(): "method": "POST", "_verb": "post", "towns": towns - } -``` - -This code defines a POST endpoint `/open` that returns a list of towns in Cameroun. It uses an in-memory list `towns` to store the town names. The endpoint checks if the request method is POST, and if not, it raises a 405 Method Not Allowed error. The response includes the method ("POST"), the method metadata ("_verb": "post"), and the list of towns. \ No newline at end of file + } \ No newline at end of file