From 1483a6c45686bc5313c9f8e476a7f15f693abc42 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Fri, 23 Aug 2019 15:45:29 -0600 Subject: [PATCH] Video 32 --- weather-app/app.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/weather-app/app.js b/weather-app/app.js index cddcf17..27240fb 100644 --- a/weather-app/app.js +++ b/weather-app/app.js @@ -1,8 +1,7 @@ const request = require('request') -const url = 'https://api.darksky.net/forecast/0466bccb953c0b9daeb091a529da2c0d/37.8267,-122.4233' +const url = 'https://api.darksky.net/forecast/0466bccb953c0b9daeb091a529da2c0d/37.8267,-122.4233?units=si' -request({ url: url }, (error, response) => { - const data = JSON.parse(response.body) - console.log(data.currently) +request({ url: url, json: true }, (error, response) => { + console.log(response.body.daily.data[0].summary + ' It is currently ' + response.body.currently.temperature + ' degrees out. There is a ' + response.body.currently.precipProbability + '% chance of rain.') })