저희(BE)와 μ—¬λŸ¬λΆ„(FE)은 직렬이 μ•„λ‹ˆλΌ λ³‘λ ¬λ‘œ κ°œλ°œμ„ μ§„ν–‰ν•©λ‹ˆλ‹€. 효율적인 ν˜‘μ—…μ„ μœ„ν•΄ μ•„λž˜ 흐름을 μ°Έκ³ ν•΄ μ£Όμ„Έμš”!

1️⃣ ν˜‘μ—… ν”„λ‘œμ„ΈμŠ€ 3단계

  1. 계약 (API λͺ…μ„Έμ„œ):
  2. 병렬 개발 (Mocking):
  3. 연동 (Integration):

2️⃣ 데이터 톡신 흐름 (Technical Flow)

  1. μš”μ²­ (FE β†’ BE):
  2. 응닡 (BE β†’ FE):
  3. 반영 (Update):

βœ… μ°Έκ³  사항 (BEκ°€ 지원할 것)

μ˜ˆμ‹œ

// ν”„λ‘ νŠΈμ—”λ“œ (React) 개발자의 μ½”λ“œ μ˜ˆμ‹œ

// 1. API 호좜 ν•¨μˆ˜ (μ£Όλ¬Έμ„œ λ„£κΈ°)
const login = async (email, password) => {
  try {
    // 2. λ°±μ—”λ“œ μ„œλ²„λ‘œ μš”μ²­ λ°œμ‚¬! (POST)
    const response = await axios.post('http://localhost:8080/api/v1/auth/login', {
      email: email,
      password: password
    });

    // 3. λ°±μ—”λ“œκ°€ μ€€ 응닡(JSON) 확인
    console.log("μ„œλ²„κ°€ μ€€ 데이터:", response.data);
    
    // 4. λ°›μ•„μ˜¨ 데이터λ₯Ό Zustand μŠ€ν† μ–΄μ— μ €μž₯ (ν™”λ©΄ κ°±μ‹ )
    setStore({ user: response.data.user, token: response.data.token });

  } catch (error) {
    alert("둜그인 μ‹€νŒ¨! 아이디λ₯Ό ν™•μΈν•΄μ£Όμ„Έμš”.");
  }
};