34 lines
768 B
Python
34 lines
768 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from routers import analyze, homebox
|
|
|
|
app = FastAPI(
|
|
title="Homebox AI Frontend API",
|
|
description="Backend for AI-powered Homebox item addition",
|
|
version="1.0.0",
|
|
)
|
|
|
|
# CORS middleware for development
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(analyze.router, prefix="/api", tags=["analyze"])
|
|
app.include_router(homebox.router, prefix="/api", tags=["homebox"])
|
|
|
|
|
|
@app.get("/api/health")
|
|
async def health_check():
|
|
return {"status": "ok"}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|