Accuweather Node
Installation Instructions
In your project directory, run:
npm install --save node-accuweather
Usage
Get your AccuWeather API Key at http://developer.accuweather.com/user/register.
var accuweather = require('node-accuweather')()(YOUR_API_KEY);
To Get Current Weather Conditions Based on Keyword Location (In Farenheit)
accuweather.getCurrentConditions("New York")
.then(function(result) {
console.log(result);
});
In Celsius
accuweather.getCurrentConditions("New York", {unit: "Celsius"})
.then(function(result) {
console.log(result);
});
Note that this will return the "best match" result based on a keyword search, so "New York"s in other places besides the US won't return a result. See below to query based on specific key.
Listing Location Keys Based on Keyword Search
Using the same example, but with New York, NY's specific AccuWeather Location Key.
accuweather.queryLocations("New York").then(function(result) {
console.log(result);
});
To Get Current Weather Conditions Based on AccuWeather Specific Location Key
Once you have your location key, you can get the current conditions based on that.
accuweather.getCurrentConditions("349727")
.then(function(result) {
console.log(result);
});