Skip to content

Commit 512c44d

Browse files
committed
fix: enable CORS for static front-end
1 parent 42d150b commit 512c44d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

api/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@
3535
from api.nodes.assets_node import AssetsNode
3636

3737
import logging
38+
from fastapi.middleware.cors import CORSMiddleware
3839
app = FastAPI(title="Prompt Bootstrapper API")
40+
# Enable CORS so the static front-end can call API from a different origin
41+
app.add_middleware(
42+
CORSMiddleware,
43+
allow_origins=["*"], # adjust to specific origins in production
44+
allow_credentials=True,
45+
allow_methods=["*"],
46+
allow_headers=["*"],
47+
)
3948
logger = logging.getLogger("api.main")
4049

4150

0 commit comments

Comments
 (0)