From db37d04c1d69843432410b8b7abacdd5c424dcea Mon Sep 17 00:00:00 2001 From: Ivan Golikov Date: Sat, 17 Dec 2022 16:02:09 +0100 Subject: [PATCH] Basic implementation for get secret endpoint --- src/rectes/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rectes/main.py b/src/rectes/main.py index 5e23523..6f8d0fb 100644 --- a/src/rectes/main.py +++ b/src/rectes/main.py @@ -16,3 +16,10 @@ async def set_secret(data: Secret): "status": "saved", "retrieval_url": f"/secret/{new_key}", } + + +@app.get("/secret/{secret_key}", response_model=Secret) +async def get_secret(secret_key): + return { + "data": await redis.get(secret_key), + }