My API is Misbehaving…

Joshua Hunt
1 min readJun 15, 2017

--

I tried to start working with the Dungeons and Dragons (DnD) API last night. I used the ‘fetch boilerplate’ we learned about yesterday. At first I got a CORs error. I got some help fixing that, but after that I still was getting an error.

The code that is throwing the error is:

function classSpells(){
var myInit = {mode: 'no-cors'}
fetch('http://dnd5eapi.co/api/classes/', myInit)
.then( function(resp){
return resp.json()
})
.then(function(json){
console.log(json);
})
}
classSpells();

I talked to a student in the night section and she showed me another way of calling API’s. I may have to learn that format to make this work, not sure yet.I will be seeking some help on this today and report back.

--

--

Joshua Hunt

Former chemist, The Iron Yard student, future web developer in perpetual training