// https://twitter.com/wesbos/status/1063515277911052290/photo/1 async function soFetch(input, settings = {}) { const response = await fetch(input, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json' }, ...settings }); return response.json(); } async function useIt() { // Get Request const notes = await soFetch(endpoint); // Post Request const createdNote = await soFetch(endpoint, { method: 'POST', body: JSON.stringify({ title: 'new note' }) }); }