mirror of
https://github.com/UofCBaja/BajaCloud.git
synced 2025-06-12 20:04:16 -06:00
fix(main): added cors policy
This commit is contained in:
parent
f50f7ebfbd
commit
07074c5f26
10
main.py
10
main.py
@ -1,5 +1,6 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from pydantic import BaseModel
|
||||
|
||||
from InterviewBooking.NoSheet import NoSheet
|
||||
@ -16,6 +17,15 @@ if not os.path.isfile(file_name):
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# Add CORS Middleware to allow cross-origin requests
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"], # Allow all origins, you can replace "*" with a specific list like ["https://example.com"]
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"], # Allow all HTTP methods (GET, POST, etc.)
|
||||
allow_headers=["*"], # Allow all headers
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
def get_root():
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user