dark-sky-skeleton
Advanced tools
Comparing version 0.1.43 to 0.1.44
{ | ||
"name": "dark-sky-skeleton", | ||
"version": "0.1.43", | ||
"version": "0.1.44", | ||
"description": "barebones dark sky weather api - for client or server-side js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ # dark-sky-skeleton | ||
An isomorphic barebones js wrapper library for Dark Sky API (previously known as Forecast.io). See Dark Sky developer docs: [https://darksky.net/dev/docs](https://darksky.net/dev/docs). | ||
A barebones js wrapper library for Dark Sky api (previously known as Forecast.io). See Dark Sky developer docs: [https://darksky.net/dev/docs](https://darksky.net/dev/docs). | ||
@@ -18,6 +18,4 @@ For a more robust solution see [dark-sky-api](https://github.com/deanbot/dark-sky-api). | ||
## Client Side Setup | ||
## Import it | ||
### Import it | ||
```javascript | ||
@@ -27,6 +25,16 @@ import DarkSkySkeleton from 'dark-sky-skeleton'; | ||
### Initialize it | ||
or Common JS | ||
```javascript | ||
const DarkSkySkeleton = require('dark-sky-skeleton'); | ||
``` | ||
## Initialize it | ||
`DarkSkySkeleton(apiKey, proxy)` | ||
- {string|bool} apiKey - your Dark Sky api key or false if using proxy | ||
- {string|bool} [proxy] - optional url to proxy service or true if running server-side | ||
### Client-side Setup | ||
```javascript | ||
@@ -36,24 +44,18 @@ const api = new DarkSkySkeleton('your-dark-sky-api-key'); | ||
#### Experimental (untested - help wanted) | ||
The above is simple and great for testing, but it exposes your api key in client side requests. Using a server-side proxy to make the actual api call to dark sky and is highly suggested as this hides the API key from client side requests [[ref](https://darksky.net/dev/docs/faq#cross-origin)]. | ||
#### Proxy URL - Client-side be warned! | ||
The proxy would receive a request issued by dark-sky-api and attach this query to a base uri (like the following: `https://api.darksky.net/forecast/your-api-key`) and return a final request. | ||
The above is simple and great for testing, but your api key is exposed in every request (when running in client-side). Using a server-side proxy to make the actual api call to dark sky is highly suggested as this hides the api key. [[ref](https://darksky.net/dev/docs/faq#cross-origin)]. | ||
To use a proxy set your api-key to false or an empty string, and pass a url to the proxy service as the proxy (second) param. | ||
```javascript | ||
import DarkSkySkeleton from 'dark-sky-skeleton'; | ||
const api = new DarkSkySkeleton(false, '//base-url-to-proxy/service'); | ||
``` | ||
## Server Side Setup | ||
#### Experimental (help wanted) | ||
### Import it | ||
Dark sky skeleton theoretically supports a proxy service (aka untested). A proxy service would receive a request issued by dark-sky-skeleton, attach this query to a base uri (like the following: `https://api.darksky.net/forecast/your-api-key`), and return a final request. | ||
```javascript | ||
const DarkSkySkeleton = require('dark-sky-skeleton'); | ||
``` | ||
### Server Side Setup | ||
### Initialize it | ||
`DarkSkySkeleton(apiKey, proxy)` | ||
```javascript | ||
@@ -63,3 +65,3 @@ const api = new DarkSkySkeleton('your-dark-sky-api-key', true); | ||
Passing true as the proxy parameter indicates that the caller is server-side (_and essentially a proxy_). | ||
Passing true as the proxy parameter indicates that the caller is server-side. Awesome! | ||
@@ -90,5 +92,5 @@ ## Use it | ||
### Make use of excludes | ||
## Make use of excludes | ||
"Exclude some number of data blocks from the API response. This is useful for reducing latency and saving cache space ([see 'Request Parameters'](https://darksky.net/dev/docs/forecast))." | ||
"Exclude some number of data blocks from the api response. This is useful for reducing latency and saving cache space ([see 'Request Parameters'](https://darksky.net/dev/docs/forecast))." | ||
@@ -95,0 +97,0 @@ ```javascript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12092
99