Get the weather with an emoji βοΈ π
- Repo - https://github.com/luctst/weather-emoji
- Package - https://www.npmjs.com/package/weather-emoji
Install:
Run
npm install -D weather-emoji
Import the package:
const weatherEmoji = require('weather-emoji');
Note - We're using the openweather API to fetch the data, it requires that you create a key, click on the link to register and generate your key.
Usage:
const WeatherEmoji = require("weather-emoji");
const weatherEmoji = new WeatherEmoji(secretApiKey);
const emojiParis = weatherEmoji.getWeather("paris", true).then(data => data);
console.log(emojiParis.emoji); // return emoji
With async / await:
const WeatherEmoji = require("weather-emoji");
(async () => {
const weatherEmoji = new WeatherEmoji(secretApiKey);
const emojiNewYork = await weatherEmoji.getWeather("new york", true);
console.log(emojiNewYork.emoji);
})()
More informations here - https://www.npmjs.com/package/weather-emoji
Happy coding β¨π§βπ»
Top comments (0)