From 6fbaf2861e6639c69940fc93e7b5cb3814da1043 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 9 Oct 2021 20:39:33 +0200 Subject: [PATCH] liberal CORS --- pizzicore/pizzicore.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pizzicore/pizzicore.py b/pizzicore/pizzicore.py index d04c6e9..f574842 100644 --- a/pizzicore/pizzicore.py +++ b/pizzicore/pizzicore.py @@ -10,6 +10,7 @@ from starlette.websockets import WebSocketDisconnect from fastapi.security import HTTPBasic, HTTPBasicCredentials from fastapi.encoders import jsonable_encoder from fastapi.staticfiles import StaticFiles +from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel @@ -83,6 +84,16 @@ class Manager: app = FastAPI() + + +app.add_middleware( + CORSMiddleware, + allow_origins=['*'], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + app.mount("/static", StaticFiles(directory="static"), name="static") manager = Manager() counter_store = Store(