Spaces:
Sleeping
Sleeping
accessing static file
Browse files- backend/app.py +7 -0
backend/app.py
CHANGED
|
@@ -179,5 +179,12 @@ async def chat_endpoint(websocket: WebSocket, username: str):
|
|
| 179 |
del clients[username]
|
| 180 |
await broadcast_user_list()
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
if __name__ == "__main__":
|
| 183 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 179 |
del clients[username]
|
| 180 |
await broadcast_user_list()
|
| 181 |
|
| 182 |
+
@app.get("/frontend/{path:path}")
|
| 183 |
+
async def serve_frontend(path: str):
|
| 184 |
+
full_path = os.path.join("frontend", path)
|
| 185 |
+
if os.path.exists(full_path):
|
| 186 |
+
return FileResponse(full_path)
|
| 187 |
+
return {"error": "File not found"}
|
| 188 |
+
|
| 189 |
if __name__ == "__main__":
|
| 190 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|