Dark Sky API is no more available

It’s not really a bug report but in the Asynchronous Programming in Node.js course, Dark Sky Weather API is used to get the current weather forecast. And on their website, they announced that it’s no more possible to sign up for the API key. So instead I’ve used OpenWeatherMap API by changing a few things and it worked perfectly.

1 Like

Hi! Thanks for letting us know about this :slight_smile:

Hi Casablanca, could you please elaborate on how exactly did you set up OpenWeatherMap API in place of Dark Sky Weather API?
It will be really helpful for me, thanks.

weather.js should be something like this

//  Fill here the API key you get from openweathermap
var OWMAPIKEY = '';
var getWeather = (lat, lng, callback) => {
  request(
    {
      url: `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lng}&units=metric&appid=${OWMAPIKEY }`,
      json: true,
    },
    (error, response, body) => {
      if (!error && response.statusCode === 200) {
        callback(undefined, {
          temperature: body.main.temp,
          apparentTemperature: body.main.feels_like,
        });
      } else {
        callback(error);
      }
    }
  );
};
1 Like

Thanks @Casablanca ! :smile:
I was able to code my way around the API.
Again, thanks for the suggestions!