Hello all,
I am trying to work on the TwitchTV app. I am the first to admit that I feel less than confident about. I have gotten this far in the curriculum and I am feeling frustrated because I don’t feel like I fully understand what I did that worked and why I did it. But the research I have done so far hasn’t resolved this.
1st question:
Is there a good resource to fill in the gaps in knowledge about what I am doing (any time I try to make a call to an API for data)? The resources are either not comprehensive enough, encyclopedic in their breadth (like MDN) which causes my brain to overload, or to specific while being general (the Twitch Documentation). Or maybe I am skimming over the information I need. I don’t know.
2nd question:
What am I doing wrong? I seem unable to get any response. I am not seeing anything happen in the code-pen console. The only thing showing in the Chrome console is a CORS error message from the Code-pen site that is unrelated to my code.
let request = new XMLHttpRequest();
let url = "GET https://wind-bow.gomix.me/twitch-api/streams/freecodecamp";
let data;
request.open("GET", url, true);
request.onload = function(){
if (this.status >= 200 && this.status < 400) {
data = JSON.parse(this.response);
console.log("Success! That's right!");
console.log(data);
} else {
console.log("error. It's a freaking 404");
}
request.send();
}
Thanks,
Gabe