add cors
This commit is contained in:
parent
c5feefe354
commit
af992f2991
|
@ -1,6 +1,21 @@
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from api.route import router
|
from api.route import router
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
app.include_router(router)
|
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=["*"],
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue