From 6e9d19a71203299b03d9359924a1c832006e45dd Mon Sep 17 00:00:00 2001 From: THOLOT DECHENE Matthieu Date: Thu, 8 Jan 2026 15:35:41 +0000 Subject: [PATCH] test: Test api on raspberry --- test_api.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test_api.py diff --git a/test_api.py b/test_api.py new file mode 100644 index 0000000..a36fd11 --- /dev/null +++ b/test_api.py @@ -0,0 +1,20 @@ +from fastapi import FastAPI +from pydantic import BaseModel +import time + +app = FastAPI(title="Test API (no serial)") + +class Echo(BaseModel): + msg: str + +@app.get("/health") +def health(): + return {"ok": True, "ts": time.time()} + +@app.get("/ping") +def ping(): + return {"pong": True} + +@app.post("/echo") +def echo(body: Echo): + return {"echo": body.msg}