Promise를 기반으로 API호출하기.

Kyle_Kim·2023년 2월 4일
0
async function getData() {
  // fetch를 통해서 api를 호출하면 편지 내용을 본게 아니라 편지봉투를 본것이다.(rawResponse)
  let rawResponse = await fetch("https://jsonplaceholder.typicode.com/posts");
  let jsonResponse = await rawResponse.json();
  console.log(jsonResponse);
}

getData();
profile
Make Things Right

0개의 댓글