From af992f2991ee26d7e1e1d3554173bfe7eb2d41af Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 11 Jan 2025 16:35:25 +0000 Subject: [PATCH] add cors --- backend/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/main.py b/backend/main.py index 22adbe0..6221e0b 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,6 +1,21 @@ from fastapi import FastAPI from api.route import router +from fastapi.middleware.cors import CORSMiddleware app = FastAPI() app.include_router(router) + +origins = [ + "https://baseddata.io", + "https://api.baseddata.io", +] + +# Add the CORS middleware to the app +app.add_middleware( + CORSMiddleware, + allow_origins=origins, + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +)