Commit
·
2e4da7c
1
Parent(s):
0619723
enable cors
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI,HTTPException, Request, Query
|
|
|
|
| 2 |
from fastapi.responses import JSONResponse
|
| 3 |
from typing import Optional, List
|
| 4 |
from LoadBalancer import LoadBalancer
|
|
@@ -14,6 +15,16 @@ REPO = os.getenv("REPO")
|
|
| 14 |
|
| 15 |
app = FastAPI()
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
@app.on_event("startup")
|
| 18 |
async def startup_event():
|
| 19 |
global load_balancer
|
|
|
|
| 1 |
from fastapi import FastAPI,HTTPException, Request, Query
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.responses import JSONResponse
|
| 4 |
from typing import Optional, List
|
| 5 |
from LoadBalancer import LoadBalancer
|
|
|
|
| 15 |
|
| 16 |
app = FastAPI()
|
| 17 |
|
| 18 |
+
origins = ["*"]
|
| 19 |
+
|
| 20 |
+
app.add_middleware(
|
| 21 |
+
CORSMiddleware,
|
| 22 |
+
allow_origins=origins,
|
| 23 |
+
allow_credentials=True,
|
| 24 |
+
allow_methods=["*"],
|
| 25 |
+
allow_headers=["*"],
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
@app.on_event("startup")
|
| 29 |
async def startup_event():
|
| 30 |
global load_balancer
|