Simple package that makes it easy to work with OpenWeather API
npm install openweather-api-node
Simple package that makes it easy to work with OpenWeather API.
npm i openweather-api-node
`
Examples
JS:
`js
const { OpenWeatherAPI } = require("openweather-api-node")
let weather = new OpenWeatherAPI({
key: "put-key-here",
locationName: "New York",
units: "imperial"
})
/*
you can use setters as well:
weather.setKey("put-key-here")
weather.setLocationByName("New York")
...
*/
weather.getCurrent().then(data => {
console.log(Current temperature in New York is: ${data.weather.temp.cur}\u00B0F)
})
`
TS:
`ts
import OpenWeatherAPI from "openweather-api-node"
let weather = new OpenWeatherAPI({
key: "put-key-here",
locationName: "New York",
units: "imperial"
})
/*
you can use setters as well:
weather.setKey("put-key-here")
weather.setLocationByName("New York")
...
*/
weather.getCurrent().then(data => {
console.log(Current temperature in New York is: ${data.weather.temp.cur}\u00B0F)
})
`
Documentation for v2 & v3
Documentation for older versions
---
#### Old OneCall API support
This package partially uses the OneCall 3.0 api endpoint. If you want to use older version of the OneCall api you can install the latest version of the package that supported it:
`
npm i openweather-api-node@2.1.2
``