Fetch API
- Fetch API 의 가장 유용하고, 핵심적인 함수는
fetch()
함수 - 가장 간단한 형태의
fetch()
함수는 URL 을 인자로 받고 응답을 처리하기 위한promise
를 반환. - 응답을 처리할 때
Response
객체를 이용 할 수 있다
fetch(endpoint)
.then(blob => blob.json())
.then(data => cities.push(...data));
fetch()
함수fetch()
함수는 URL 을 인자로 받고 응답을 처리하기 위한 promise
를 반환.Response
객체를 이용 할 수 있다fetch(endpoint)
.then(blob => blob.json())
.then(data => cities.push(...data));