-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (23 loc) · 807 Bytes
/
app.js
File metadata and controls
40 lines (23 loc) · 807 Bytes
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 lugar = require('./LUGAR/lugar.js');
const clima = require('./CLIMA/clima');
const argv = require('yargs').options({
direccion: {
alias: 'd',
desc: 'Direccion de una ciudad para obtener el clima',
demand: true
}
}).argv;
/*lugar.getLugarLatLng(argv.direccion).then(resp => {
return console.log(resp);
}).catch(err => console.log(err));*/
const getInfo = async(direccion) => {
try {
const resp = await lugar.getLugarLatLng(direccion);
const temp = await clima.getClima(resp.lng, resp.lat);
return `El Temperatura de ${ direccion} es de ${ temp } `;
} catch (e) {
return `Ocurrio un errar al obtener la temperatura de ${ direccion}`;
}
}
getInfo(argv.direccion).then(console.log)
.catch(console.log);