🔧 프론트엔드 API URL 설정 개선

- 프로덕션에서 nginx 프록시를 통한 /api 경로 사용
- 환경변수 VITE_API_URL을 통한 유연한 설정 지원
- Docker Compose에서 환경변수 주입 설정 추가
This commit is contained in:
Hyungi Ahn
2025-08-01 13:46:07 +09:00
parent f34eb0e210
commit a7e4c0158e
2 changed files with 40 additions and 1 deletions

View File

@@ -1,8 +1,9 @@
import axios from 'axios';
// 환경변수에서 API URL을 읽음 (Vite 기준)
// 프로덕션에서는 nginx 프록시를 통해 /api 경로 사용
const API_BASE_URL = import.meta.env.VITE_API_URL ||
(import.meta.env.DEV ? 'http://localhost:8000' : 'http://localhost:8000');
(import.meta.env.DEV ? 'http://localhost:8000' : '/api');
console.log('API Base URL:', API_BASE_URL);
console.log('Environment:', import.meta.env.MODE);