■開発する機能(変数urlには上記のhtttpリクエストが入ります)
読むasync function getName() { const response = await fetch(url, {method: "GET", mode: "cors" }) }
新規に投稿するasync function putName() { const response = await fetch(url, {method: "POST", mode: "cors", headers: {"Content-Type": "application/json" }, body: JSON.stringify({ flag: false, plan: plan, result: result })}); }
削除するasync function deleteName() { const response = await fetch(url, { method: "DELETE", mode: "cors", headers: {} }); }
置き換えするasync function updateName() { const response = await fetch(url, { method: "PUT", mode: "cors", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ flag: flag, plan: plan, result: result }) }); }