-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
41 lines (32 loc) · 924 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const yargs = require('yargs');
const geocode = require('./geocode/geocode');
const weather = require('./weather/weather');
const argv = yargs
.option('address',{
alias: 'a',
demand:true,
describe:"Adress to be fetched",
string:true
})
.help()
.argv;
//console.log(argv.address);
geocode.geocodeAddress(argv.address,(errormessage,results)=>{
if(errormessage){
console.log(errormessage);
}
else{
const lat= results.latitude;
const lon=results.longitude;
weather.getWeather(lat,lon,(error,weatherresults)=>{
if(error){
console.log(error);
}
else{
console.log(JSON.stringify(results,undefined,2));
console.log(JSON.stringify(weatherresults,undefined,2));
}
});
}
}
);