diff --git a/weather-app/app.js b/weather-app/app.js index 5c52f2b..7b1322e 100644 --- a/weather-app/app.js +++ b/weather-app/app.js @@ -1,12 +1,23 @@ const geocode = require('./utils/geocode') const forecast = require('./utils/forecast') -geocode('Boston', (error, data) => { - console.log('Error', error) - console.log('Data', data) -}) +const address = process.argv[2] -forecast(-75.7088, 44.1545, (error, data) => { - console.log('Error', error) - console.log('Data', data) -}) +if (!address) { + console.log('Please provide an address') +} else { + geocode(address, (error, data) => { + if (error) { + return console.log(error) + } + + forecast(data.latitude, data.longitude, (error, forecastData) => { + if (error) { + return console.log(error) + } + + console.log(data.location) + console.log(forecastData) + }) + }) +}