weather-information-api

1.0.1 • Public • Published

Weather Information API

A simple JavaScript package to fetch weather information from OpenWeatherMap API.

Installation

You can install the package via npm:

npm install weather-information-api

Usage

First, import the WeatherAPI class from the package:

const WeatherAPI = require('weather-information-api');

Then, create an instance of WeatherAPI with your OpenWeatherMap API key:

const apiKey = 'YOUR_API_KEY';
const weather = new WeatherAPI(apiKey);

You can fetch weather data by city name using the getWeatherByCity method:

const cityWeather = await weather.getWeatherByCity('London');
console.log('Weather in London:', cityWeather);

Or you can fetch weather data by coordinates using the getWeatherByCoordinates method:

const coordWeather = await weather.getWeatherByCoordinates(51.51, -0.13);
console.log('Weather at coordinates:', coordWeather);

Replace 'YOUR_API_KEY' with your actual OpenWeatherMap API key.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i weather-information-api

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

3.09 kB

Total Files

3

Last publish

Collaborators

  • beniukbohdan