Spaces:
Runtime error
Runtime error
Upload api\basic_api.py with huggingface_hub
Browse files- api//basic_api.py +33 -0
api//basic_api.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Basic API for Vercel deployment without database dependencies
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from fastapi import FastAPI
|
| 6 |
+
|
| 7 |
+
app = FastAPI(title="Todo API - Basic", version="1.0.0")
|
| 8 |
+
|
| 9 |
+
@app.get("/")
|
| 10 |
+
def root():
|
| 11 |
+
"""Root endpoint for health check."""
|
| 12 |
+
return {
|
| 13 |
+
"message": "Todo API is running on Vercel",
|
| 14 |
+
"status": "healthy",
|
| 15 |
+
"deployment": "serverless",
|
| 16 |
+
"note": "Full functionality requires database setup"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
@app.get("/health")
|
| 20 |
+
def health():
|
| 21 |
+
"""Health check endpoint."""
|
| 22 |
+
return {"status": "healthy", "timestamp": "2026-01-14"}
|
| 23 |
+
|
| 24 |
+
@app.get("/status")
|
| 25 |
+
def status():
|
| 26 |
+
"""Status endpoint."""
|
| 27 |
+
return {
|
| 28 |
+
"api": "Todo API",
|
| 29 |
+
"version": "2.0.0",
|
| 30 |
+
"status": "deployed",
|
| 31 |
+
"platform": "Vercel serverless",
|
| 32 |
+
"database_status": "not connected (requires external database)"
|
| 33 |
+
}
|