diff options
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +from lifxlan import LifxLAN, BLUE + +from litestar import Litestar, get, post + + +@get("/") +async def index() -> str: + return "Hello, world!" + + +@post("/") +async def post_index() -> dict[str, str]: + lifxlan = LifxLAN() + try: + lifxlan.set_color_all_lights(BLUE, rapid=True) + except Exception as e: + return {"status": "error", "message": str(e)} + + return {"status": "ok"} + + +app = Litestar([index, post_index]) |