File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 22This module provides an API for interacting with musical instruments and their finger positions.
33"""
44
5+ from pathlib import Path
6+
57from fastapi import FastAPI
68from fastapi .middleware .cors import CORSMiddleware
9+ from fastapi .responses import HTMLResponse
710from pydantic import BaseModel
811
912from src .instruments .neck_instrument import (
@@ -50,10 +53,13 @@ class NoteInput(BaseModel):
5053)
5154
5255
53- @app .get ("/" )
54- def read_root () -> dict :
55- """Root endpoint for the API."""
56- return {"message" : "Welcome to the Optimal Musical Instrument Fingering API!" }
56+ @app .get ("/" , response_class = HTMLResponse )
57+ def read_root () -> HTMLResponse :
58+ """Root endpoint for the API, returns the frontend HTML."""
59+ index_path = Path (__file__ ).parents [3 ] / "frontend" / "index.html"
60+ if index_path .exists ():
61+ return HTMLResponse (content = index_path .read_text (encoding = "utf-8" ))
62+ return HTMLResponse (content = "<h1>index.html not found</h1>" )
5763
5864
5965@app .get ("/getInstrumentDetails" )
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ dependencies = [
1818 " pretty-midi>=0.2.10" ,
1919 " pydantic==2.11.7" ,
2020 " requests==2.32.4" ,
21+ " setuptools>=80.9" ,
2122 " uvicorn==0.35" ,
2223]
2324urls.repository = " https://github.com/eliot-christon/optimal-musical-fingering"
You can’t perform that action at this time.
0 commit comments