Skip to content

BeniukBohdan/weather-information-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published