Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
weather-api-lib
Advanced tools
Readme
For FEW 2.1 (Advanced Javascript) at Make School. Assignment #3.
https://www.npmjs.com/package/weather-api-lib
This WeatherAPI Project is a Neumorphic Dark-Mode Weather Website.
Built in Javascript ES6 and HTML, this repo operates with Open Weather Map API.
v1.1.4
scripts.js
contains a library that could be used by anyone who wanted to use the OpenWeatherMap API in any project they might create. There are 3 functions built into this file. You are expected to provide your own API key from openweathermap.org. index.js
and index.html
are included for an example of operation. The variable apiKey can be inserted in line #19 of scripts.js
or imported through a config.js
which was not included and should be added into your .gitignore
to prevent unauthorized access.
getWeatherByZip()
allows searching by zip code.(params)
are:
zip
: A 5 digit USA based zip codeapiKey
: You will need to input your own API Key for your project.units
: No entry will default to 'imperial', but options are 'metric' or 'kelvin')getWeatherByCity()
allows searching by city name.params
are:
city
: City NameapiKey
: Your API Keyunits
getWeatherByGeo()
allows searching with Latitude & Longitude.params
are:
lat
: Latitudelon
: LongitudeapiKey
: Your API Keyunits
All functions take input through a single input field and resolve to a promise that returns temperature, a short weather description, what the local weather feels like and the daily minimum and maximum temperature into HTML elements. The input field can differentiate between USA Zip code, City Name or Latitude/Longitude geo coordinates.
scripts.js
is a self contained library for API calls.
index.js
contains the scripts that allow index.html
to function which is part of this repo but not necessary for your library.
fetch()
resolves promises to set the temperature, description on elements in the DOM. The getWeatherX()
functions are handled by a callback. A Promise
simplifies and streamline the asynchronous code. async
and await
keywords are used with Promise to streamline the code. Additionally, the script.js
file streamlines the 'openweatherorg' API's JSON data for better organization.
The getWeatherbyX()
functions are automatically chosen within the catchAllWeather()
function and resolved with If statements. This is done in a separate index.js
file as the scripts.js
library file only contains code for reusable API calls.
$ Open project in live server to run in your browser.
$ npm install for dependencies.
scripts.js
file.FAQs
This repo contains some starter code that works with the [Open Weather Map API](https://openweathermap.org).
The npm package weather-api-lib receives a total of 3 weekly downloads. As such, weather-api-lib popularity was classified as not popular.
We found that weather-api-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.