import time from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import logging import datetime from router.router_api import router as router_api from router.card_service import router as router_card from router.image_api import router as image_api from router.manage_user_api import router as manage_user_api from router.room_score_api import router as room_score_api # test from router.test_service import router as test_service_api app = FastAPI() # docker로 수행하기 때문에 로그는 생략 # logger = logging.getLogger() # logger.setLevel(logging.INFO) # file_handler = logging.FileHandler("testtest.log") # logger.addHandler(file_handler) # ----------------------------------------------------------------------------------------------- # CORS 설정 origins = [ "http://localhost", "http://localhost:3000", "https://localhost", "https://localhost:3000", "http://eldsoft.com", "http://eldsoft.com:3000", "https://eldsoft.com", "https://eldsoft.com:3000" ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # /api app.include_router(router_api) # /api/card app.include_router(router_card) # /images app.include_router(image_api) # /user app.include_router(manage_user_api) # /room/score app.include_router(room_score_api) # /test app.include_router(test_service_api) # /iot-kt # app.include_router(router_iot_kt) # /iot-lg # app.include_router(router_iot_lg) @app.get("/ttt") async def test_endpoint(data: dict): return {"get received_data": data} @app.post("/ttt") async def test_endpoint(data: dict): return {"received_data": data}