Spaces:
Sleeping
Sleeping
Upload main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.staticfiles import StaticFiles
|
| 3 |
+
from fastapi.responses import FileResponse
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
app = FastAPI()
|
| 7 |
+
|
| 8 |
+
# Mount the specific static directory
|
| 9 |
+
app.mount("/static", StaticFiles(directory="backend/static"), name="static")
|
| 10 |
+
|
| 11 |
+
@app.get("/")
|
| 12 |
+
async def read_root():
|
| 13 |
+
# Serve the index.html from the backend/static folder
|
| 14 |
+
return FileResponse('backend/static/index.html')
|
| 15 |
+
|
| 16 |
+
@app.get("/health")
|
| 17 |
+
async def health_check():
|
| 18 |
+
return {"status": "ok", "location": "backend/static"}
|