https://github.com/jenni/weather-app
Nodejs weather app using Google Maps and Dark Sky API
https://github.com/jenni/weather-app
axios callbacks darksky-api google-maps-api promises request
Last synced: about 1 month ago
JSON representation
Nodejs weather app using Google Maps and Dark Sky API
- Host: GitHub
- URL: https://github.com/jenni/weather-app
- Owner: jenni
- Created: 2018-03-25T19:46:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T15:39:37.000Z (about 8 years ago)
- Last Synced: 2025-02-26T10:12:52.358Z (over 1 year ago)
- Topics: axios, callbacks, darksky-api, google-maps-api, promises, request
- Language: JavaScript
- Size: 38.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Weather app
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.
```
#### Callbacks, Promise wrappers, Promise based library...
This repository shows three different ways of requesting data from **Dark Sky API**. These are:
* **Callbacks** : **`app-callbacks/app.js`** : makes use of `request` 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 the `request` HTTP request client, non-compatible Promise library. `requests` have been wrapped in custom Promise declarations to use `promise chaining` or `async/await` : **`-> node app-request-promise/app.js --a berlin`** .
* **Calls via Promised based library** : **`app-axios-promise/app.js`** : requires `axios`, 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]
```