From 68fdc0de7e6da779d53ad145fd26081fbfda967e Mon Sep 17 00:00:00 2001 From: c7c4ff Date: Sat, 31 Aug 2024 17:23:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=B1=EC=97=94=EB=93=9C=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=ED=8C=8C=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/main.py | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/Backend/main.py b/Backend/main.py index 2dd98e9c..c0a2b77b 100644 --- a/Backend/main.py +++ b/Backend/main.py @@ -4,15 +4,8 @@ from auth_router import router as auth_router from fastapi import FastAPI from starlette.middleware.sessions import SessionMiddleware -from fastapi.middleware.cors import CORSMiddleware from test_router import router as test_router -#date, score 받아오는 엔드포인트 설정 -from fastapi import Depends -from sqlalchemy.orm import Session -from database import SessionLocal, engine -from models import Score - app = FastAPI() app.include_router(auth_router, prefix="/api") app.include_router(test_router, prefix="/api") @@ -31,34 +24,8 @@ def load_config(filename): SessionMiddleware, secret_key=google_config.get("middleware_secret_key") ) -app.add_middleware( - CORSMiddleware, - allow_origins=["*"], # 또는 특정 도메인을 설정 - allow_credentials=True, - allow_methods=["*"], - allow_headers=["*"], -) - -@app.middleware("http") -async def add_coop_header(request, call_next): - response = await call_next(request) - response.headers['Cross-Origin-Opener-Policy'] = 'same-origin-allow-popups' - return response # 기본 연결 확인 @app.get("/") def connection_test_handler(): - return {"Dunning": "Kruger"} - -#date, score 받아오는 엔드포인트 설정 -def get_db(): - db = SessionLocal() - try: - yield db - finally: - db.close() - -@app.get("/api/scores/") -def get_scores(db: Session = Depends(get_db)): - scores = db.query(Score).all() # 모든 Score 객체 가져오기 - return scores \ No newline at end of file + return {"Dunning": "Kruger"} \ No newline at end of file