7️날씨 데이터 조회하기
데이터 페칭
export const getCurrentWeather = async (): Promise<CurrentWeatherResponse> => {
const apiPath = `http://api.weatherapi.com/v1/current.json?key={API_KEY}`
const res = await fetch(apiPath)
if (!res.ok) throw new Error('날씨 정보를 가져올 수 없습니다.')
return res.json()
}환경 변수 다루기
에러와 로딩 대응하기
데이터 재검증하기
라우트 핸들러
Last updated