tlong-ds commited on
Commit
3456591
·
verified ·
1 Parent(s): 9deb732

Update services/api/db/auth.py

Browse files
Files changed (1) hide show
  1. services/api/db/auth.py +11 -16
services/api/db/auth.py CHANGED
@@ -29,15 +29,21 @@ from sqlalchemy.orm import Session
29
  # Add parent directory to path to enable imports
30
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
31
 
32
- # Create FastAPI app
33
  app = FastAPI()
34
 
35
- # Configure CORS
36
  app.add_middleware(
37
  CORSMiddleware,
38
- allow_origins=["http://localhost:3000, https://tlong-ds.github.io/thelearninghouse/"], # Your React frontend URL
39
- allow_credentials=True, # Important for cookies
40
- allow_methods=["*"],
 
 
 
 
 
 
41
  allow_headers=["*"],
42
  expose_headers=["*"]
43
  )
@@ -68,17 +74,6 @@ MYSQL_PORT = int(os.getenv("MYSQL_PORT", "3306"))
68
 
69
 
70
 
71
- # Initialize FastAPI app
72
- app = FastAPI()
73
- app.add_middleware(
74
- CORSMiddleware,
75
- allow_origins=["http://localhost:8503", "http://localhost:3000", "http://127.0.0.1:3000", "https://tlong-ds.github.io"],
76
- allow_credentials=True,
77
- allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
78
- allow_headers=["*"],
79
- expose_headers=["*"],
80
- )
81
-
82
  # Import and include chat router
83
  try:
84
  from services.api.chat_endpoints import router as chat_router
 
29
  # Add parent directory to path to enable imports
30
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
31
 
32
+ # Create single FastAPI instance
33
  app = FastAPI()
34
 
35
+ # Configure CORS with all needed origins
36
  app.add_middleware(
37
  CORSMiddleware,
38
+ allow_origins=[
39
+ "http://localhost:8503",
40
+ "http://localhost:3000",
41
+ "http://127.0.0.1:3000",
42
+ "https://tlong-ds.github.io",
43
+ "https://tlong-ds.github.io/thelearninghouse/"
44
+ ],
45
+ allow_credentials=True,
46
+ allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
47
  allow_headers=["*"],
48
  expose_headers=["*"]
49
  )
 
74
 
75
 
76
 
 
 
 
 
 
 
 
 
 
 
 
77
  # Import and include chat router
78
  try:
79
  from services.api.chat_endpoints import router as chat_router