From 144ac314f7203bb47ef9445cc2f92031e0b005b8 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Sat, 2 Nov 2024 23:04:23 +0100 Subject: [PATCH] Tell what game we are on --- src/alfagok/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/alfagok/main.py b/src/alfagok/main.py index edb80d6..e2aadc3 100644 --- a/src/alfagok/main.py +++ b/src/alfagok/main.py @@ -59,6 +59,12 @@ def read_root(): return {"Hello": "World"} +@app.get('/api/game') +def what_game(): + """Handle incoming guess.""" + return {'game': get_game_id()} + + @app.get('/api/guess') def handle_guess(word: Union[str, None] = None): """Handle incoming guess.""" @@ -78,7 +84,7 @@ def handle_guess(word: Union[str, None] = None): logger.info('Guess: %s for game %d (%s), goal is %s', word, current_game_id, word_of_the_day, hint) # before, after, it - return {'hint': hint} + return {'game': current_game_id, 'hint': hint} @app.get("/api/answer/{item_id}")