aider-vy1l4b/endpoints/aid.post.py
2025-03-25 10:15:36 +01:00

36 lines
697 B
Python

```python
from fastapi import APIRouter, HTTPException
import uuid
games = [] # In-memory storage
router = APIRouter()
@router.post("/aid")
async def save_games(
games_list: list
):
"""Save list of games to the database"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
for game in games_list:
game_id = str(uuid.uuid4())
games.append({
"id": game_id,
"game": game
})
return {
"method": "POST",
"_verb": "post",
"message": "Games saved successfully",
"games_saved": len(games_list)
}
```
```
# requirements.txt
fastapi
uvicorn
```