1
0
CompleteNodeJS/weather-app/app.js

24 lines
508 B
JavaScript
Raw Normal View History

2019-08-25 20:57:02 +00:00
const geocode = require('./utils/geocode')
2019-08-25 21:16:02 +00:00
const forecast = require('./utils/forecast')
2019-08-25 19:57:08 +00:00
2019-08-25 21:31:41 +00:00
const address = process.argv[2]
if (!address) {
console.log('Please provide an address')
} else {
2019-09-29 18:36:49 +00:00
geocode(address, (error, {latitude, longitude, location}) => {
2019-08-25 21:31:41 +00:00
if (error) {
return console.log(error)
}
2019-09-29 18:36:49 +00:00
forecast(latitude, longitude, (error, forecastData) => {
2019-08-25 21:31:41 +00:00
if (error) {
return console.log(error)
}
2019-09-29 18:36:49 +00:00
console.log(location)
2019-08-25 21:31:41 +00:00
console.log(forecastData)
})
})
}