Skip to content

Commit 98a1f55

Browse files
committed
introduce back
1 parent ef1ba4b commit 98a1f55

13 files changed

+16
-0
lines changed
1.2 KB
Binary file not shown.

back/python/serve.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from fastapi import FastAPI
2+
from fastapi.responses import FileResponse
3+
from fastapi.staticfiles import StaticFiles
4+
import os
5+
6+
app = FastAPI()
7+
8+
# Serve the entire 'front' folder at '/'
9+
app.mount("/static", StaticFiles(directory=os.path.abspath("../../front")), name="static")
10+
11+
app.mount("/resources", StaticFiles(directory=os.path.abspath("../../front/resources")), name="resources")
12+
app.mount("/src", StaticFiles(directory=os.path.abspath("../../front/src")), name="src")
13+
14+
@app.get("/")
15+
async def serve_index():
16+
return FileResponse(os.path.abspath("../../front/index.html"))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)