-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f5327c
Showing
9 changed files
with
535 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"esversion": 8 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Aplicacion de Clima | ||
Esta aplicación nos muestra a que temperatura estamos según la ciudad que le enviemos por consola. | ||
|
||
Utiliza las API de: | ||
- [City Geolocation](https://rapidapi.com/dev132/api/city-geo-location-lookup), con la cual obtenemos la latitud y longitud según el nombre de la ciudad | ||
- [Open Weather Map](https://openweathermap.org/), con la cual obtenemos la temperatura según la latitud y longitud de la ciudad. | ||
|
||
### Uso | ||
1. Para poder instalar todos los paquetes debemos ejecutar el siguiente comando. | ||
``` | ||
npm install | ||
``` | ||
2. Para obtener el mensaje con la temperatura de la ciudad debemos usar el siguiente comando | ||
``` | ||
node app -d 'Cucuta Colombia' | ||
#Output El clima de Cucuta Colombia es de 28°C. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { argv } = require('./config/yargs'); | ||
const { getLatLng } = require('./place/devrull'); | ||
const { getClima } = require('./place/weather'); | ||
|
||
// getLatLng(argv.direccion) | ||
// .then(resp => { | ||
// return getClima(resp.lat, resp.lng); | ||
// }) | ||
// .then(resp => console.log(resp)) | ||
// .catch(err => console.log("Error", err)); | ||
|
||
const getInfo = async(direccion) => { | ||
try { | ||
const geolokt = await getLatLng(direccion); | ||
const weather = await getClima(geolokt.lat, geolokt.lng); | ||
return `El clima de ${direccion} es de ${weather}°C.`; | ||
} catch (err) { | ||
return `No se pudo determinar el clima de ${direccion}`; | ||
} | ||
|
||
|
||
}; | ||
|
||
getInfo(argv.direccion) | ||
.then(console.log) | ||
.catch(console.log); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const argv = require('yargs') | ||
.options({ | ||
direccion: { | ||
alias: 'd', | ||
demand: true | ||
} | ||
}) | ||
.help() | ||
.argv; | ||
|
||
module.exports = { | ||
argv | ||
}; |
Oops, something went wrong.