Spaces:
Sleeping
Sleeping
Add root endpoint to provide API info and health status
Browse files- app/main.py +12 -0
app/main.py
CHANGED
|
@@ -33,6 +33,18 @@ def _load_origins() -> list[str]:
|
|
| 33 |
app = FastAPI(title="CrownCode Backend API", version="0.1.0")
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
@app.exception_handler(ValueError)
|
| 37 |
async def value_error_handler(request: Request, exc: ValueError) -> JSONResponse:
|
| 38 |
logger.warning(f"Validation error: {exc}")
|
|
|
|
| 33 |
app = FastAPI(title="CrownCode Backend API", version="0.1.0")
|
| 34 |
|
| 35 |
|
| 36 |
+
@app.get("/")
|
| 37 |
+
async def root():
|
| 38 |
+
"""Root endpoint for health check and API info."""
|
| 39 |
+
return {
|
| 40 |
+
"name": "CrownCode Backend API",
|
| 41 |
+
"version": "0.1.0",
|
| 42 |
+
"status": "running",
|
| 43 |
+
"docs": "/docs",
|
| 44 |
+
"health": "/api/health"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
@app.exception_handler(ValueError)
|
| 49 |
async def value_error_handler(request: Request, exc: ValueError) -> JSONResponse:
|
| 50 |
logger.warning(f"Validation error: {exc}")
|