magicboris commited on
Commit
27ef471
·
verified ·
1 Parent(s): 91caed9

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +16 -0
backend/main.py CHANGED
@@ -55,6 +55,22 @@ app = FastAPI(
55
  version="1.0.0",
56
  )
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Configure logging
59
  LOGGING_CONFIG["formatters"]["default"][
60
  "fmt"
 
55
  version="1.0.0",
56
  )
57
 
58
+
59
+ # раздача Next.js
60
+ frontend_dir = pathlib.Path(__file__).parent.parent / "frontend"
61
+ app.mount("/", StaticFiles(directory=frontend_dir / ".next" / "static"), name="static")
62
+
63
+ # fallback на index.html
64
+ @app.get("/{full_path:path}")
65
+ async def spa(full_path: str):
66
+ return FileResponse(frontend_dir / "public" / "index.html")
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
  # Configure logging
75
  LOGGING_CONFIG["formatters"]["default"][
76
  "fmt"