Skip to content

Commit

Permalink
allow cors
Browse files Browse the repository at this point in the history
  • Loading branch information
matyson committed May 15, 2024
1 parent bb8e622 commit e033f30
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Annotated

from fastapi import FastAPI, Depends, Body, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
from apscheduler.schedulers.background import BackgroundScheduler

Expand Down Expand Up @@ -29,6 +30,14 @@ async def lifespan(_: FastAPI):

app = FastAPI(root_path="/api", dependencies=[Depends(verify_token)], lifespan=lifespan)

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


@app.get("/")
def read_root():
Expand Down

0 comments on commit e033f30

Please sign in to comment.