This site was created by Jason Williams. It uses data from mapbox.com and darksky.net!
+This site was created by Jason Williams. It uses data from mapbox.com and weatherstack.com!
diff --git a/web-server/src/utils/forecast.js b/web-server/src/utils/forecast.js index 11cb167..cafd7bb 100644 --- a/web-server/src/utils/forecast.js +++ b/web-server/src/utils/forecast.js @@ -1,7 +1,7 @@ const request = require('request') const forecast = (latitude, longitude, callback) => { - const url = 'https://api.darksky.net/forecast/bae9e39ba5c00299d5a95b35c1ae20cc/' + latitude + ',' + longitude + '?units=si' + const url = 'http://api.weatherstack.com/current?access_key=360ee65db0f798aa09021f493b5b02c9&query=' + latitude + ',' + longitude + '&units=m' request({ url, json: true }, (error, {body}) => { if (error) { @@ -9,7 +9,7 @@ const forecast = (latitude, longitude, callback) => { } else if (body.error) { callback('Unable to find location', undefined) } else { - callback(undefined, body.daily.data[0].summary + ' It is currently ' + body.currently.temperature + ' degrees out. Today\'s high will be ' + body.daily.data[0].temperatureMax + ' degrees, with a low of ' + body.daily.data[0].temperatureMin + '. There is a ' + body.currently.precipProbability + '% chance of rain.') + callback(undefined, body.current.weather_descriptions[0] + '. It is currently ' + body.current.temperature + ' degress out. It feels like ' + body.current.feelslike + ' degress.') } }) } diff --git a/web-server/src/utils/geocode.js b/web-server/src/utils/geocode.js index 31852ef..fbbd4d0 100644 --- a/web-server/src/utils/geocode.js +++ b/web-server/src/utils/geocode.js @@ -4,7 +4,6 @@ const geocode = (address, callback) => { const url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/' + encodeURIComponent(address) + '.json?access_token=pk.eyJ1IjoiamFzb24zMmRldiIsImEiOiJjazFsNHd5djcwMXptM2htbW8zM3MyZGxuIn0.-TtNNGFysQPQRfGR1P8DUA&limit=1' request({ url, json: true }, (error, {body}) => { - console.log(body) if (error) { callback('Unable to connect to location services!', undefined) } else if (body.features.length === 0) { diff --git a/web-server/templates/views/about.hbs b/web-server/templates/views/about.hbs index f440f3a..e032008 100644 --- a/web-server/templates/views/about.hbs +++ b/web-server/templates/views/about.hbs @@ -11,7 +11,7 @@
This site was created by Jason Williams. It uses data from mapbox.com and darksky.net!
+This site was created by Jason Williams. It uses data from mapbox.com and weatherstack.com!