sync post 데이터 획득
async function post(host, path, body, headers = {}) { const url = `https://${host}/${path}`; const options = { method: "POST", headers: { "Content-Type": "application/json", ...headers, }, body: JSON.stringify(body), }; const res = await fetch(url, options); const data = await res.json(); if (res.ok) { return data; } else { throw Error(data); } } post("jsonplaceholder.typicode.com", "posts", { t..
더보기