As I mentioned in a previous post, I completed the Wikipedia Viewer project for freeCodeCamp. I wasn’t entirely happy with it though. I had used the opensearch action, and while I liked the results it came up with- I thought they were quirky and interesting, it wasn’t really what was intended from the project.
I decided, after finishing my own project and reviewing a lot of other peoples’, that I wanted to revisit it, and use the API’s query function instead. I was happy with the way the page looked, and the way it displayed the search results, so I decided not to touch the HTML or CSS, and only change the JavaScript.
You can see my Wikipedia Viewer 2.0 here.
I started out with the same code as for my previous Wikipedia Viewer, and commented out all of the javascript. I started rewriting the essential functions, and then I got a bit stuck again when I got to the meat of the project- the part where I was actually communicating with the Wikipedia API.
Wikipedia has [what seems to me anyway!] pretty comprehensive documentation for their API, and one of parts I found a lot more useful this time around was the API Sandbox- a page where you can pick and choose all the data you would like, and it gives you the url you need to make the request. It’s also useful because it tells you which properties you can specify [some can be used with one action, but throw an error if used with another,] and you can try out the url within the page, so you can see if any errors pop up. I did still find the documentation a little overwhelming, but I tried to just look at what was relevant, and ignore the rest!
One of the features I might like to add to the Wikipedia Viewer is something that I’ve seen a few people suggest: use the opensearch action to suggest searches as the user is typing in the search box. That’s apparently the proper use of that particular action, and I think it would really add something to the page, so depending on when you read this, I might have implemented it already!
I’m continuing on with The Web Developer Bootcamp course on Udemy, and focusing more on that than freeCodeCamp for now. I’m learning some pretty valuable things that I can apply in the fCC projects- in this project for example I can see that my code has become a bit more efficient, and I feel like I’m thinking about projects in a more logical way than I was previously.