Restruct files, prepare for next feature

This commit is contained in:
2024-08-06 17:14:00 +02:00
parent 7cec02f649
commit 3cc104e08e
9 changed files with 44 additions and 36 deletions

23
src/main.py Normal file
View File

@@ -0,0 +1,23 @@
from contextlib import asynccontextmanager
from fastapi import FastAPI
from src.recorder.poo import PooRecorder
recorder = PooRecorder()
@asynccontextmanager
async def _lifespan(_app: FastAPI): # noqa: ANN202
await recorder.start()
yield
await recorder.stop()
app = FastAPI(lifespan=_lifespan)
@app.put("/record/s={status}")
async def record(status: str) -> dict:
await recorder.record(status)
return {"status": status}