Add CORS
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from fastapi import FastAPI, HTTPException
|
from fastapi import FastAPI, HTTPException
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from .routers import docOffices, patients, patients_files, patients_notes, users
|
from .routers import docOffices, patients, patients_files, patients_notes, users
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
app.include_router(docOffices.router)
|
app.include_router(docOffices.router)
|
||||||
@@ -9,6 +10,20 @@ app.include_router(patients_files.router)
|
|||||||
app.include_router(patients_notes.router)
|
app.include_router(patients_notes.router)
|
||||||
app.include_router(users.router)
|
app.include_router(users.router)
|
||||||
|
|
||||||
|
origins = [
|
||||||
|
"http://localhost",
|
||||||
|
"http://localhost:80",
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=origins,
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
# Check if server is up
|
# Check if server is up
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
def read_root():
|
def read_root():
|
||||||
|
|||||||
Reference in New Issue
Block a user