File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88BASE_DIR = Path (__file__ ).resolve ().parent .parent
99WEB_DIR = BASE_DIR / "web"
1010INDEX_PATH = WEB_DIR / "index.html"
11+ ALADIN_PATH = WEB_DIR / "aladin.html"
1112
1213app = 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 )
1623def 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
You can’t perform that action at this time.
0 commit comments