This app will provide current weather of selected city
- Add city and press enter
- Choose your city
- results will be displayed
- Beautiful and simple GUI
- Responsive design that works with desktop and mobile
- Graphical respresentation of day and night
- Beautiful grphical icons to show weather
- Temperature selection
To get weather api there are several websites available. I used https://developer.accuweather.com/apis and signup and follow the following steps:-
- Go to
MY APPS
andadd a new App
- Get API key (this key be used to get weather info)
- Get city details
- Get city weather details
const getCity = async (city) => {
const baseUrl = "https://dataservice.accuweather.com/locations/v1/cities/search";
const queryParameters = `?apikey=${apikey}&q=${city}`;
const response = await fetch(baseUrl + queryParameters);
const data = await response.json();
return data[0];
};
const getWeather = async (locationKey) => {
const baseUrl = "https://dataservice.accuweather.com/currentconditions/v1/";
const queryParameters = `${locationKey}?apikey=${apikey}`;
const response = await fetch(baseUrl + queryParameters);
const data = await response.json();
return data[0];
};
app.js code is updating UI for weather by DOM manupulation
- JavaScript
- Bootstrap
- HTML5
- CSS3
- Simple HTML/CSS/JS
- Well organized
- Well comminted
- Self descriptive
- Easy to understand