@vvansh739/weather-package
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -9,7 +9,7 @@ "use strict"; | ||
const dotenv_1 = __importDefault(require("dotenv")); | ||
// Load environment variables from .env file | ||
dotenv_1.default.config(); | ||
const API_KEY = process.env.OPENWEATHERMAP_API_KEY; | ||
const API_URL = "http://api.openweathermap.org/data/2.5/weather"; | ||
const BASE_URL = 'https://api.openweathermap.org/data/2.5/weather'; | ||
if (!API_KEY) { | ||
console.error("API_KEY is not set"); | ||
throw new Error('Missing OpenWeatherMap API key in environment variables'); | ||
@@ -19,11 +19,11 @@ } | ||
try { | ||
const response = await axios_1.default.get(API_URL, { | ||
const response = await axios_1.default.get(BASE_URL, { | ||
params: { | ||
q: city, | ||
units: "metric", | ||
appid: API_KEY | ||
appid: API_KEY, | ||
units: 'metric' | ||
} | ||
}); | ||
const { weather, main, wind, name } = response.data; | ||
console.log(`Weather in ${name}`); | ||
console.log(`Weather in ${name}:`); | ||
console.log(`Description: ${weather[0].description}`); | ||
@@ -35,4 +35,4 @@ console.log(`Temperature: ${main.temp}°C`); | ||
catch (error) { | ||
console.error("Error fetching weather data", error); | ||
console.error('Error fetching weather data:', error); | ||
} | ||
} |
{ | ||
"name": "@vvansh739/weather-package", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A simple module to fetch and display current weather information", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@vvansh739/weather-package": "^1.0.0", | ||
"@vvansh739/weather-package": "^1.0.1", | ||
"axios": "^1.7.2", | ||
@@ -25,0 +25,0 @@ "dotenv": "^16.4.5" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2357
4