Connected authentication to the backend and fixed CORS

This commit is contained in:
2022-06-04 16:27:39 +02:00
parent 72123aee2f
commit 4667029869
15 changed files with 3194 additions and 106 deletions

13
main.py
View File

@@ -1,4 +1,5 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from strawberry.fastapi import GraphQLRouter
from api.schema import schema
@@ -13,5 +14,17 @@ graphql_app = GraphQLRouter(
app = FastAPI()
origins = [
"http://localhost:3000",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(graphql_app, prefix="/graphql")
app.mount("/", SPAStaticFiles(directory="frontend/dist", html=True), name="frontend")