Coding Journal 7 — Free Code Camp Twitch API Project

Welcome to Coding Journal 7! Today I started working on the Twitch API project on Free Code Camp. Before I show you today’s coding journal, though, I want to take a moment to share my experience using this SEO plugin that I told you about in yesterday’s post.

SEO Is It Working?

No, it is not. I followed the instructions given by this plugin and was disappointed to find that my blog is not on any pages of the Google search results for the keyword “coding journal”. I looked at all 25 pages, too. If any of you know anything about SEO, could you give me some tips? Now that I know that there is a method to being on the front page of Google, I want to be there.

Coding Jornal 7

Now that that’s out of the way, let’s get to the journal.

Inspiration

I decided to get back to working through Free Code Camp after reading another blog. The author talked about making the calculator and it reminded me that not all of the projects on Free Code Camp were as lame and as frustrating as this one. I am one project away from being done with API! The post also got me excited about the calculator project, too.

Is it okay to share links to other people’s blog posts without asking? I don’t know. Here is her blog post, anyway.

Okay, this time for real, we are going to talk about today’s coding journal.

Todays Coding Journal

Here are the scans of the coding journal.

coding journal page 1

coding journal page 2

Pre-Coding Activities

I started off my making a “trash” Twitch account. This account will be used for this project and nothing more. After the account was created, I wrote down the user stories of the project as bullets so that I could fill them and check them off in my coding journal instead of having to have Free Code Camp open in another tab.

Time To Code

I went to the free code camp forum post about this project. There, I read that you can add a callback=? to the end of a URL and have it work with JSON’s get method even though CORS is a thing that exists. It is supposed to treat the request as JSONP.

The Client ID – It Worked!

The requests weren’t going through because I did not have a client ID, so I went and got one. The process was easy! This was a surprise for me because getting the client ID was the reason I quit the project before. It would not work for me and I still don’t know why. It worked perfectly today, though. I just stuck the ID at the end or the URL in the API getting thing and it got me an object! You know that feel you get when things just magically start working? Yea, I got that.

Getting the data and displaying it on the page… or not

I successful looped through the array of usernames and created a div for each of them. My plan was to give each of the divs an ID based on the username of the Twitch user who’s info would be displayed within them, but, after further evaluation of this plan, I decided against it. I remembered that I could index the children of an element but couldn’t remember how. A quick web search solved that.

childNode[index] is what I was thinking about. I planned to use this to loop through the children that I just appended to the streamers div and put data in them. Getting the childNode only worked outside the JSON thing. Making a var to hold the data inside the JSON function, then, successfully console logging it outside the function made me think that it was working, it was not. I tried pars-ing, then stringify-ing, and stringify-ing, then, pars-ing, nothing.

Eventually, I just looked at another one of my API projects because I remembered getting data out of the JSON thing, I just couldn’t remember how I did it. One of my projects used AJAX but the method seemed like it would work the same. And it did. The method was to create a function to display the data and pass it the data and i from the loop. I console logged the data and i and that worked fine. I could not, though, use i to index a div. The last thing I tried was to make a loop inside the function to display the data. For obvious reasons, that did not work.

I have some ideas of things that might work that I will implement tomorrow.

If you have any ideas about the not being on google thing, let me know, please. Also, I am still looking for more blogs to read, so if you have one, let me know. And don’t be afraid to correct me, I definitely need it.

Thanks for reading and I will see you again tomorrow! And every after that until 100DaysOfCode is done.

BYE

-view other journal posts here-

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *