function sendRequest(method, url, body = null){
const headers = {
'Content-Type': 'application/json'
}
return fetch(url, {
method: method,
mode: 'cors',
headers: headers
} ).then(response =>{
return response.json()
})
}
sendRequest('GET', requestURL)
.then(data => console.log(data))
.catch(err => console.log(err))