add homekeeper stack
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.routers import (
|
||||
apiaries,
|
||||
colonies,
|
||||
inspections,
|
||||
varroa,
|
||||
harvests,
|
||||
actions,
|
||||
queens,
|
||||
checklists,
|
||||
lists,
|
||||
)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
from app.database import init_db
|
||||
init_db()
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="Beekeeper API",
|
||||
version="1.0.0",
|
||||
root_path=os.getenv("ROOT_PATH", ""),
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
app.include_router(apiaries.router, prefix="/v1/apiaries", tags=["apiaries"])
|
||||
app.include_router(colonies.router, prefix="/v1/colonies", tags=["colonies"])
|
||||
app.include_router(inspections.router, prefix="/v1/inspections", tags=["inspections"])
|
||||
app.include_router(varroa.router, prefix="/v1/varroa", tags=["varroa"])
|
||||
app.include_router(harvests.router, prefix="/v1/harvests", tags=["harvests"])
|
||||
app.include_router(actions.router, prefix="/v1/actions", tags=["actions"])
|
||||
app.include_router(queens.router, prefix="/v1/queens", tags=["queens"])
|
||||
app.include_router(checklists.router, prefix="/v1/checklists", tags=["checklists"])
|
||||
app.include_router(lists.router, prefix="/v1/lists", tags=["lists"])
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"status": "ok"}
|
||||
Reference in New Issue
Block a user