Spaces:
Runtime error
Runtime error
File size: 2,039 Bytes
1ffd0a4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | """
CIRO Backend β FastAPI Application Entry Point
Run locally:
uv run uvicorn backend.main:app --reload
"""
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from backend.core.config import settings
from backend.core.firebase import init_firebase
from backend.routes import auth, crises, crisis, crowd_verification, report, trace, weather
@asynccontextmanager
async def lifespan(app: FastAPI):
init_firebase()
yield
app = FastAPI(
title="CIRO Backend",
description="Crisis Intelligence & Response Orchestrator β agentic AI backend",
version="0.1.0",
debug=settings.debug,
lifespan=lifespan,
redoc_url="/redoc",
docs_url="/docs",
)
# ββ CORS ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Tighten in production
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# ββ Routers βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
app.include_router(crises.router)
app.include_router(crisis.router)
app.include_router(trace.router)
app.include_router(report.router)
app.include_router(auth.router)
app.include_router(weather.router)
app.include_router(crowd_verification.router)
# ββ Health Check ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
@app.get("/")
async def root():
"""Root endpoint β HF Spaces health-checks GET /."""
return {"status": "ok", "service": "ciro-backend"}
@app.get("/health")
async def health():
"""Readiness probe for Cloud Run and local dev verification."""
return {"status": "ok"}
|