Added v2 API routes and hard-coded static files to support Connect

Connect looks for /routes and /api/v2/streams/snapshot
These are now present and working.

I've also hard coded the static files directory - fixing this
properly is a work in progress.
This commit is contained in:
Richard Bowman 2023-12-11 23:59:11 +00:00
parent 60f854b7db
commit 753514c24b
2 changed files with 25 additions and 2 deletions

View file

@ -15,7 +15,8 @@ def add_static_file(app: FastAPI, fname: str, folder: str):
def add_static_files(app: FastAPI):
#with importlib.resources.as_file(openflexure_microscope_server) as p:
# static_path = p.join("/static/")
static_path = "./src/openflexure_microscope_server/static"
#TODO: don't hard code this!
static_path = "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/static"
if not os.path.isdir(static_path):
raise RuntimeError("Can't find static files :(")