FCC Speedrun — Show the Local Weather

P1xt
P1xt’s Blog
Published in
2 min readMar 15, 2017
Local Weather Project screenshot

And, I’m back to the frontend projects. Next up, the local weather project. I’ll admit it, this project gave me fits — well, making it work on surge.sh did. Everything just plain worked on localhost but “CORS” reared it’s ugly head the second I deployed and I ended up having to rework some stuff.

A confession: I cheated. Instead of using using the native geolocation function I pulled the user’s location from an API. Reason: my browser thinks I’m in a different city than I actually am, the data from http://freegeoip.net was more accurate, so I went with that instead.

Basically, other than having to create services to first get location and then get weather data, this project was just more of the same things I’ve been doing for every project: Scaffold an app in Angular 2, pull in some generic styling, stub in the elements I’ll need to display the data I need to display, then go get the data and populate the elements.

Notes:

Notes for me:

  • When I merge this project into a portfolio, I need to handle getting the weather on the serverside so as not to expose my API key (and I should spin up a different API key cancelling the current one at that point).
  • It is possible for ad-blockers to block the call to freegeoip, before I incorporate this into a proper portfolio, I need to find some better solution
  • I should get better at using promises in Angular 2. My local weather component currently looks like the poster child for callback hell.

My progress in the Speedrun thusfar:

--

--