Skip to content

Commit 6494185

Browse files
committed
Put back the aladin route
1 parent 85eb722 commit 6494185

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/server.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,29 @@
88
BASE_DIR = Path(__file__).resolve().parent.parent
99
WEB_DIR = BASE_DIR / "web"
1010
INDEX_PATH = WEB_DIR / "index.html"
11+
ALADIN_PATH = WEB_DIR / "aladin.html"
1112

1213
app = FastAPI(title="NASA Sky Explorer Prototype")
1314

1415

16+
def _read_html(path: Path) -> str:
17+
if not path.exists():
18+
raise HTTPException(status_code=404, detail=f"{path.name} not found")
19+
return path.read_text(encoding="utf-8")
20+
21+
1522
@app.get("/", response_class=HTMLResponse)
1623
def read_index() -> str:
1724
"""Return the contents of the bundled ``index.html`` file."""
1825

19-
if not INDEX_PATH.exists():
20-
raise HTTPException(status_code=404, detail="index.html not found")
21-
return INDEX_PATH.read_text(encoding="utf-8")
26+
return _read_html(INDEX_PATH)
27+
28+
29+
@app.get("/aladin", response_class=HTMLResponse)
30+
def read_aladin() -> str:
31+
"""Serve the Aladin viewer page."""
32+
33+
return _read_html(ALADIN_PATH)
2234

2335

2436

0 commit comments

Comments
 (0)