Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Review final screencast result


    Our lesson has been planned, recorded, and edited. It’s ready to be uploaded to egghead.io! Victory dance. Let’s see how it all turned out.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    We're ready to upload our lesson to egghead.io. Let's see what the finished product looks like. First let's type consturl, and let's set that equal to the GitHub API, so that's api.github.com/users, and then we need some sort of user here. Now let's type constuser = some GitHub user name, which if we use mine, that's TrevorDMiller.

    Now we can use the global fetch function by saying fetch and then passing it our URL. This function will return a promise, so we can say .then and when this promise resolves, it will contain our response. We'll say response, and now inside of this function we can say response.json to convert our response into JSON.

    Now let's type .then, we'll have our JSON data. Let's console log out the type of the GitHub account. We see we have the type of user, because the TrevorDMiller GitHub account is of type user. If we go back up to our user string here and use Facebook, we now see that Facebook is of type organization.

    Now let's go down and type .catch and this will be used if we get an error. We will get our error, and we can use that error. Let's just log out the error in this case. Let me turn off my network connection. Now we get this type error, failed to fetch.