-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.py
More file actions
24 lines (21 loc) 路 804 Bytes
/
Copy pathroutes.py
File metadata and controls
24 lines (21 loc) 路 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from aiohttp import web
from data_loader import get_parquet_files
from websocket_handler import websocket_handler
from config import logger
# Endpoint to list dataset names
async def list_datasets(request):
logger.info("Listing datasets")
files = get_parquet_files()
datasets = [f.replace('.parquet', '') for f in files]
return web.json_response(datasets)
# Serve static HTML files
async def serve_static(request):
path = request.match_info.get('path', 'index.html')
file_path = os.path.join('static', path)
if os.path.isfile(file_path):
logger.info(f"Serving static file: {path}")
return web.FileResponse(file_path)
else:
logger.info(f"File not found: {path}, serving index.html")
return web.FileResponse('static/index.html')