Welcome to the Treehouse Community
Looking to learn something new?
Best solution for command line weather app using forecast.io
So I don't see any thread where there's a way for people who're stuck at the Extra Credit weather app to figure out what to do.
Most people have used other APIs instead of forecast because the other ones take zip codes directly and are hence easier. Because forecast.io needs latitude and longitude. So for forecast, we need another API first to convert zip code to latitude and longitude.
I think as a coding challenge, it's not right for us to use 'easier' APIs like OpenWeather etc as they accept Zip Codes or city names directly. They have one step less, but that means we don't get to practice using two APIs in the same app and feeding the results of one API to the other.
Hence, I have chosen to use zipcodeapi.com to convert zip codes to lat and long coordinates.
It's very simple code, all you need to do is add you API key from zipcodeapi.com in getLocation.js and from https://developer.forecast.io in getWeather.js
The only confusing part of the code is going to be "callback" that I have used throughout to be able to share data objects between files, so if at all anyone needs help explaining that, reply to this thread.
Feel free to fork the workspace and try it out on your own!
Here is my take on the app:
Please remember to add your API keys before using a command like
node app.js 90210
Without the API keys you'll get a not found error, obviously.
Bhavesh Bansal13,810 Points
Here is my take http://w.trhou.se/2yien43770
You can pass City Name, Zip Code or Lat/Long (city name) - node app.js London
(zip code) - node app.js 94040
(lat,long) - node app.js 35 129
Any suggestions are welcomed I am using Open Weather Map API. I have included my API Key but if you want you can get your API key from http://openweathermap.org/api