Allow CORS
This commit is contained in:
parent
9847ba105c
commit
69b4d0eb33
@ -1,5 +1,6 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI, APIRouter
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from routers import accidents, bikepoints, dashboard
|
||||
|
||||
@ -9,6 +10,21 @@ app = FastAPI(
|
||||
redoc_url="/api/redoc"
|
||||
)
|
||||
|
||||
origins = [
|
||||
"http://it-schwarz.net",
|
||||
"https://it-schwarz.net",
|
||||
"http://localhost",
|
||||
"http://localhost:4200",
|
||||
]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
v1_router = APIRouter()
|
||||
v1_router.include_router(accidents.router)
|
||||
v1_router.include_router(bikepoints.router)
|
||||
|
Loading…
Reference in New Issue
Block a user