|
@@ -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()
|