2.0.6 • Published 6 years ago
weather-handler v2.0.6
weather-handler
A NodeJS library for interfacing with OpenWeatherMap. Get your OpenWeatherMap key from here: https://openweathermap.org/api
Install
$npm install weather-handler
Usage
const weatherHandler = require('weather-handler'),
weather = new weatherHandler('OPENWEATHERMAP KEY');
weather.setUnit('metric'); // Metric, Imperial, Kelvin
let dataByZip = await weather.getByZip('ZIP'); // Or ('ZIP','County Code')
let dataByName = await weather.getByName('NameOfCity'); // Or ('City','County Code')
let dataByCoords = await weather.getByCoords('13','61');
let dataByID = await weather.getByID('13613613'); //OpenWeatherMaps City ID's
console.log(data);
Example
const weatherHandler = require('weather-handler'),
weather = new weatherHandler(KEY);
async function Main(){
let data = await weather.getByName('Moscow','RU');
console.log(data);
}Main();