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 {
|
|
|
|
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)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|