Fix cors issues for now
This commit is contained in:
parent
8b5c86aff8
commit
eb4d2a9611
@ -19,8 +19,19 @@ engine = create_engine(DATABASE_URL, echo=False)
|
|||||||
def create_db_and_tables():
|
def create_db_and_tables():
|
||||||
SQLModel.metadata.create_all(engine)
|
SQLModel.metadata.create_all(engine)
|
||||||
|
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
# TODO have some domain list lying around somewhere on the server and pass it to containers
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"], # Or specify your frontend domain(s)
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
def on_startup():
|
def on_startup():
|
||||||
create_db_and_tables()
|
create_db_and_tables()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user