From d8b8c0f8013c198dd94bcf476db9886ca2193111 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 17 Jan 2022 05:26:59 +0000 Subject: [PATCH] Add cors midleware --- app/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 0959f80..f812bb8 100755 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,16 @@ from fastapi import FastAPI, Depends +from fastapi.middleware.cors import CORSMiddleware from app import auth, user, server from os import getenv -app = FastAPI() +app = FastAPI(docs_url="/") + +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) dependencies = list() if not getenv('DISABLE_AUTH'):