Skip to content

Commit

Permalink
Feat: 프론트 로컬 환경에서 백엔드 서버 연동 작업 (#27)
Browse files Browse the repository at this point in the history
- 백엔드 API 엔드포인트와 프론트엔드 환경 연동 설정
  • Loading branch information
sunglitter committed Dec 5, 2024
1 parent f3798ee commit 605e556
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/axiosInstance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const axiosInstance = axios.create({
baseURL: import.meta.env.VITE_API_URL, // API URL
baseURL: 'http://15.164.5.135:8080', // API URL
timeout: 5000, // 요청 제한 시간 (ms)
headers: {
'Content-Type': 'application/json', // JSON 형식 사용
Expand Down
9 changes: 9 additions & 0 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,14 @@ export default defineConfig(({ mode }) => {
define: {
'process.env': env,
},
server: {
proxy: {
'/api': {
target: 'http://15.164.5.135:8080', // 백엔드 주소
changeOrigin: true, // CORS 우회
rewrite: (path) => path.replace(/^\/api/, '/api'), // 이 부분은 경로를 그대로 두어야 함
},
},
},
};
});

0 comments on commit 605e556

Please sign in to comment.