amalsp commited on
Commit
198202c
·
verified ·
1 Parent(s): 65512d9

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +11 -1
backend/main.py CHANGED
@@ -1,4 +1,5 @@
1
- from fastapi import FastAPI, HTTPException
 
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from fastapi.responses import StreamingResponse
4
  from pydantic import BaseModel
@@ -18,6 +19,15 @@ app.add_middleware(
18
  allow_headers=["*"],
19
  )
20
 
 
 
 
 
 
 
 
 
 
21
  class ScrapeRequest(BaseModel):
22
  url: str
23
  mode: str = "table"
 
1
+ from fastapi import FastAPI, HTTPException, HTTPException
2
+ from fastapi.staticfiles import StaticFiles
3
  from fastapi.middleware.cors import CORSMiddleware
4
  from fastapi.responses import StreamingResponse
5
  from pydantic import BaseModel
 
19
  allow_headers=["*"],
20
  )
21
 
22
+ # Mount static files
23
+ app.mount("/static", StaticFiles(directory="/code/static"), name="static")
24
+
25
+ # Root route to serve the index.html
26
+ @app.get("/")
27
+ async def read_root():
28
+ from fastapi.responses import FileResponse
29
+ return FileResponse("/code/static/index.html")
30
+
31
  class ScrapeRequest(BaseModel):
32
  url: str
33
  mode: str = "table"