CST 336 - Internet Programming (Week 3)
Week 3 - Web APIs
This week's assignment and lab introduce the use of third-party Web API into our webpage. Web API is a link to receive data from another website. From my point of view, it is quite similar with how we use query to get corresponding data from database. We can adjust the API just like we do with the query, as well as determine the parameters. Together with Web API, we are introduced with Form, async function, fetch function.
There is nothing much to say about the Lab because I did not spend too much effort to make it look better. However, the Homework assignment was different. I chose the Weather as the topic for my website.
There were many obstacles along the way. First of all, I had to sign-up on two pages to get the API key for location's weather, list of nations. At first, I planned for user to input the city and then display the correct nations. But it became complicated that I had to switch the plan. The user still input the city, but now they choose the nation from the whole list. Then, all I have to do with the submitted form is checking if input information is correct.
The rest of the assignment was about displaying the information of weather nicely, which was not a big deal for me. There was a tiny obstacle which is the background. I have to display different background based on the weather at that location. I decided to use some background images with cartoon style, which I think they fit well with Weather Page. Together with Switch( ), loading the background images correctly was not a problem.
Check out the Weather website: Weather Display
.png)
Comments
Post a Comment