diff options
Diffstat (limited to 'app/main.py')
-rw-r--r-- | app/main.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/main.py b/app/main.py index cd576c6..91111eb 100644 --- a/app/main.py +++ b/app/main.py @@ -1,4 +1,6 @@ from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware + from . import models from .database import engine, SessionLocal from .routers import post, user, auth, vote @@ -7,6 +9,15 @@ from .config import settings #models.Base.metadata.create_all(bind=engine) -- was needed for sqlalchemy before alembic app = FastAPI() +origins = ["*"] +app.add_middleware( + CORSMiddleware, + allow_origins=origins, + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + app.include_router(post.router) app.include_router(user.router) app.include_router(auth.router) |