https://github.com/projectweekend/weatherman.io
A Node.js module for the Forecast.io API.
https://github.com/projectweekend/weatherman.io
Last synced: over 1 year ago
JSON representation
A Node.js module for the Forecast.io API.
- Host: GitHub
- URL: https://github.com/projectweekend/weatherman.io
- Owner: projectweekend
- License: mit
- Created: 2014-03-20T22:39:49.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-21T22:56:38.000Z (over 11 years ago)
- Last Synced: 2025-02-01T19:29:43.849Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 270 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Install it
```
npm install weatherman.io
```
### Require it
```javascript
var weatherman = require( "weatherman.io" );
```
### Create a weatherman
```javascript
var alRoker = new weatherman( "your-forecast-io-api-key" );
```
### Create a weatherman with options
```javascript
var options = {
units: "uk",
exclude: ["minutely", "alerts"],
extend: "hourly"
};
var alRoker = new weatherman( "your-forecast-io-api-key", options );
```
Detailed information about each of these options is available in the Forecast.io developer docs: [https://developer.forecast.io/docs/v2](https://developer.forecast.io/docs/v2)
### Do the forecast from a location
```javascript
var forecastOptions = {
latitude: 41.8854710,
longitude: -87.6430260
};
alRoker.doForecast( forecastOptions, function ( err, weatherReport ) {
if ( err ) {
// handle any errors
}
// do something with the weatherReport
} );
```
### Do the forecast for a specific time (Unix timestamp)
```javascript
var forecastOptions = {
latitude: 41.8854710,
longitude: -87.6430260,
time: 1395347280
};
alRoker.doForecast( forecastOptions, function ( err, weatherReport ) {
if ( err ) {
// handle any errors
}
// do something with the weatherReport
} );
```