rbi-learning / Today-I-Learned

1 stars 0 forks source link

Jane - Week 4 Day 3 "Today I Learned..." #164

Open techniJANE opened 4 years ago

techniJANE commented 4 years ago

Getting Sanity Info onto Our Server

const sanityUrl = sanity playground URL const sanityQuery = query inside playground async function fetchSanityData () { const response = await fetch(sanityUrl, { method: “POST”, headers: { ‘Content-Type’ : ‘application/json’, ‘Accept’: ‘application/json’ }, body: JSON.stringify({ query: sanityQuery }) }) const json = await response.json() }