Skip to content

Commit

Permalink
added cors support
Browse files Browse the repository at this point in the history
  • Loading branch information
philippspinnler committed Sep 18, 2024
1 parent 753f554 commit 2a1f3af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from fastapi_cache import FastAPICache
from fastapi_cache.backends.inmemory import InMemoryBackend
from fastapi_cache.decorator import cache
from fastapi.middleware.cors import CORSMiddleware


@asynccontextmanager
Expand All @@ -22,6 +23,13 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:


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


@app.get("/")
Expand Down

0 comments on commit 2a1f3af

Please sign in to comment.