25 lines
561 B
Python
25 lines
561 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from routers import eggs, flock, feed, stats
|
|
|
|
app = FastAPI(title="Eggtracker API")
|
|
|
|
# Allow requests from the Nginx frontend (same host, different port internally)
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(eggs.router)
|
|
app.include_router(flock.router)
|
|
app.include_router(feed.router)
|
|
app.include_router(stats.router)
|
|
|
|
|
|
@app.get("/api/health")
|
|
def health():
|
|
return {"status": "ok"}
|