File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 11import logging
22from fastapi import FastAPI
3+ from fastapi .middleware .cors import CORSMiddleware
34
45from app .api .routes import admin , base
56from app .core .db_connection import init_db
1415
1516app = FastAPI (title = "Docs Manager API" , version = "0.1.0" )
1617
18+ # Configure CORS - Allow any localhost or 127.0.0.1 with any port
19+ app .add_middleware (
20+ CORSMiddleware ,
21+ allow_origin_regex = r"https?://(localhost|127\.0\.0\.1)(:\d+)?" ,
22+ allow_credentials = True ,
23+ allow_methods = ["*" ], # Includes OPTIONS
24+ allow_headers = ["*" ],
25+ )
26+
1727# Include routers
1828app .include_router (base .router )
1929app .include_router (admin .router )
Original file line number Diff line number Diff line change 22import threading
33
44from fastapi import FastAPI
5+ from fastapi .middleware .cors import CORSMiddleware
56from app .api .routes .chatMessage import router as chat_router
67from app .api .routes import router as api_router
78from app .api .routes .base import router as base_router
1617
1718app = FastAPI (title = "RAG Manager API" , version = "0.1.0" )
1819
20+ # Configure CORS - Allow any localhost or 127.0.0.1 with any port
21+ app .add_middleware (
22+ CORSMiddleware ,
23+ allow_origin_regex = r"https?://(localhost|127\.0\.0\.1)(:\d+)?" ,
24+ allow_credentials = True ,
25+ allow_methods = ["*" ], # Includes OPTIONS
26+ allow_headers = ["*" ],
27+ )
28+
1929# Global (non-versioned) routes
2030app .include_router (base_router )
2131
You can’t perform that action at this time.
0 commit comments