GitXplorerGitXplorer
b

darksky-node

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
91454d00b6b9bc6ca86a4996a2c2ce56c574df36

renamed

bbrianantonelli committed 8 years ago
Unverified
eeda1e7acf68b4b7635d24676abbb1046c7c2202

code samples

bbrianantonelli committed 8 years ago
Unverified
dd4bb93e0d97fad027caddd83a92c590ce2573f4

Cleaning up docs

bbrianantonelli committed 8 years ago
Unverified
d08fe2561e62dfb495f98fb1f6480af5476adb8b

docs

bbrianantonelli committed 8 years ago
Unverified
8d64f1d0f8649a2f5c8bece11e7879634f422cba

Cleaning up

bbrianantonelli committed 8 years ago
Unverified
1c71d74132966c7836319840077ec8dac063de33

time machine is now working

bbrianantonelli committed 8 years ago

README

The README file for this repository.

darksky-node

NodeJS API client for Dark Sky API.

Install

$ npm install darksky-node --save

Configuration

You'll need a developer key for the Dark Sky API which can you can create here.

Usage

Create an instance of the Dark Sky API Client:

var DarkSky = require('darksky-node');

var darkSkyClient = new DarkSky('myApiKey');

Options

All methods take the same options object:

  • exclude: array containing any of: currently, minutely, hourly, daily, alerts, flags.
  • extend: pass hourly for hour-by-hour data for the next 168 hours, instead of the next 48.
  • lang: en or any other i18n
  • units: us, si, ca, uk2, auto

Methods

Once you have an instance of the API you can call any of the available methods

Forecast

A Forecast Request returns the current conditions, a minute-by-minute forecast for the next hour, an hour-by-hour forecast for the next 48 hours, and a day-by-day forecast for the next week.

darkSkyClient.forecast(latitude, longitude, options, function(err, forecast){
    if(err) console.error(err);
    else console.dir(forecast);
});

Time-Machine

A Time Machine Request returns the observed (in the past) or forecasted (in the future) hour-by-hour and daily weather conditions for a particular date.

darkSkyClient.timemachine(latitude, longitude, new Date(), options, function(err, forecast){
    if(err) console.error(err);
    else console.dir(forecast);
});