Spaces:
Sleeping
Sleeping
Girish Jeswani commited on
Commit ·
c1917a8
1
Parent(s): 5ecd10b
update cors
Browse files
multi_llm_chatbot_backend/app/main.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
from app.api.routes import router
|
| 3 |
|
| 4 |
app = FastAPI(
|
|
@@ -6,6 +7,15 @@ app = FastAPI(
|
|
| 6 |
version="0.1"
|
| 7 |
)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Include route definitions
|
| 10 |
app.include_router(router)
|
| 11 |
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from app.api.routes import router
|
| 4 |
|
| 5 |
app = FastAPI(
|
|
|
|
| 7 |
version="0.1"
|
| 8 |
)
|
| 9 |
|
| 10 |
+
# Add CORS middleware
|
| 11 |
+
app.add_middleware(
|
| 12 |
+
CORSMiddleware,
|
| 13 |
+
allow_origins=["http://localhost:3000"], # React dev server
|
| 14 |
+
allow_credentials=True,
|
| 15 |
+
allow_methods=["*"],
|
| 16 |
+
allow_headers=["*"],
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
# Include route definitions
|
| 20 |
app.include_router(router)
|
| 21 |
|