Connected authentication to the backend and fixed CORS
This commit is contained in:
13
main.py
13
main.py
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user