A simple wrapper for the Wundeground API for Node.js
$ npm install wunderground-node --save
var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here', 'Boston', 'MA');
Full Init
var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here', 'Boston', 'MA');
//Gets the forecast in Boston for today
client.forecast('forecast', '', function(err, data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', '', function(err,data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', '', function(err, data){
if(err) throw err;
console.log(data);
});
Half Init
var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here'>);
var opts = {
city: 'Boston',
state: 'MA'
};
//Gets the forecast in Boston for today
client.forecast('forecast', opts, function(err, data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', opts, function(err,data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', opts, function(err, data){
if(err) throw err;
console.log(data);
});
No Init
var wunderground = require('wunderground-node');
var client = new wunderground();
var opts = {
key: '<api_key_here>',
city: 'Boston',
state: 'MA'
};
//Gets the forecast in Boston for today
client.forecast('forecast', opts, function(err, data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', opts, function(err,data){
if(err) throw err;
console.log(data);
});
//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', opts, function(err, data){
if(err) throw err;
console.log(data);
});
When configuring a new wunderground client, you must provide the following:
- key - Wunderground API key
- city - city for weather
- state - state for weather
All params are initially optional and can be overwritten using an opts object.
Gets the conditions for a specific location
Gets the forecast for a specific location
Gets the forecast 10 days in advance for a specific location
Gets the hourly conditions for a specific location
Gets the hourly conditions 10 days in advance for a specific location
Gets the alerts for a specific location
Gets the average low and high temperatures
Gets the moon phases, sunrise and sunset times
Gets information on current hurricanes and tropical storms
Gets the city name, zip/postal code, latitude & longitude coordinates
Gets the summary of the weather on the specificed date. Must be passed into the function in the format: YYYYMMDD
Gets the summary based on the time interval specified. Must be passed into the function in the format: MMDDMMDD
Gets raw tidal information
Gets the URL to the .gif visual and infrared satellite images
Gets tidal information
Gets the locations of nearby weather stations and URLs for images from their web cams
Gets the summary of the weather for yesterday
#Testing
$ mocha
See Issues
This code is licensed under the MIT license. Full license text is available in LICENSE