Promise based API client for getting weather data and forecasts from
openweathermap.org
Installation
yarn add openweathermap-api-client
Usage
import { ApiClient } from "openweathermap-api-client";
const client = new ApiClient({
apiKey: "0762980bd66840d04ea0e9bffe765113",
endpoint: "weather",
lang: "en",
units: "metric"
});
async function getWeatherData() {
const currentCityId = await client.current(36482);
const currentCityName = await client.current("Berlin");
const currentCoord = await client.current({ lat: 59.970984, lon: 10.719908 });
const currentQuery = await client.current({ })
const forecastCityId = await client.forecast(36482);
}
void getWeatherData();