Command line application to get the weather by location, sending requests to Google Maps and Dark Sky API.
➜ weather-app git:(master) ✗ node app/app.js --a kantstr. 1
It's currently 45.61 in Kantstraße, Berlin, Germany. It feels like 38.65.
This repository shows three different ways of requesting data from Dark Sky API. These are:
-
Callbacks :
app-callbacks/app.js
: makes use ofrequest
library using its native callback support:request({ opts }, callback)
. Callback hell building up much ; ) :-> node app/app.js --a 'address here'
. -
Promise wrappers :
app-request-promise/app.js
: uses therequest
HTTP request client, non-compatible Promise library.requests
have been wrapped in custom Promise declarations to usepromise chaining
orasync/await
:-> node app-request-promise/app.js --a berlin
. -
Calls via Promised based library :
app-axios-promise/app.js
: requiresaxios
, a Promise based HTTP client for node. The simplest and quickest way of requesting async data :-> node app-axios-promise.js --address lalala
CLI help:
➜ weather-app git:(master) ✗ node app/app.js --h
Options:
--version Show version number [boolean]
-a, --address Address to fetch weather for [string] [required]
--help, -h Show help [boolean]