Skip to content

Commit

Permalink
#175 Update cors middleware (#184)
Browse files Browse the repository at this point in the history
* updated cors middleware

* resolved cors error
  • Loading branch information
amnak613 authored Feb 2, 2025
1 parent ce699c5 commit ed1cf46
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion backend/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
liquefaction_api,
)
from fastapi import FastAPI

from fastapi.middleware.cors import CORSMiddleware

app = FastAPI()

Expand All @@ -30,5 +30,19 @@
app.include_router(landslide_api.router)
app.include_router(liquefaction_api.router)


origins = [
"http://localhost",
"http://localhost:3000",
]

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)

0 comments on commit ed1cf46

Please sign in to comment.