From b95d96bc0fe3966bf3fa016b56644426f5ef1001 Mon Sep 17 00:00:00 2001 From: boyska Date: Fri, 24 Sep 2021 00:52:55 +0200 Subject: [PATCH] namespace for api version --- pizzicore/pizzicore.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pizzicore/pizzicore.py b/pizzicore/pizzicore.py index a4765d6..fbe1a64 100644 --- a/pizzicore/pizzicore.py +++ b/pizzicore/pizzicore.py @@ -111,7 +111,7 @@ def get_current_role(credentials: HTTPBasicCredentials = Depends(security)): return "admin" -@app.get("/counter/{cid}") +@app.get("/v1/counter/{cid}") async def get_value(cid: int): try: val = counter_store.get(cid) @@ -121,7 +121,7 @@ async def get_value(cid: int): return Value(counter=cid, value=val) -@app.post("/counter/{cid}/increment") +@app.post("/v1/counter/{cid}/increment") async def increment(cid: int, role: str = Depends(get_current_role)): if role != "admin": raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) @@ -129,7 +129,7 @@ async def increment(cid: int, role: str = Depends(get_current_role)): return Value(counter=cid, value=val) -@app.websocket("/ws/counter/{cid}") +@app.websocket("/v1/ws/counter/{cid}") async def websocket_counter(websocket: WebSocket, cid: int): await websocket.accept() q: Queue = Queue()