Skip to content

What Weather is a forecasting weather App that allows you to get the weather conditions of a location you choose. It depends on the API of Accuweather website.

License

Notifications You must be signed in to change notification settings

Mohamed-Elhawary/what-weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What Weather

Netlify Status

What Weather is a forecasting weather App that allows you to get the weather conditions of a location you choose. It depends on the API of AccuWeather website.

You can view the App from here

Screenshot

Demo

What.Weather._.Smart.Forecast.Around.The.World.-.Google.Chrome.2023-01-26.20-12-00.mp4

Versions

  • v1

  • v1.1

    • Re-build the App with OOP JS technique, which enhance the App performance.
class Forecast {
    constructor() {
        this.myKey         = "98AOsgSnks0lZjHn5RiFy9JlXmTnDRbe";
        this.cityUrl       = "https://dataservice.accuweather.com/locations/v1/cities/search";
        this.weatherUrl    = `https://dataservice.accuweather.com/currentconditions/v1/`;
    }
    async getDetails(cityName) {
        const cityDetails    = await this.getCity(cityName);  //get promise object
        const weatherDetails = await this.getWeather(cityDetails.Key);  //get promise object
        return {cityDetails, weatherDetails}; //this is shorthand code for objects and it is equal to >>  return {cityDetails: cityDetails, weatherDetails:weatherDetails}
    }
    async getCity(city) {
        const queryParams = `?apikey=${this.myKey}&q=${city}`;
        const response    = await fetch( this.cityUrl + queryParams );
        const data        = await response.json();
        return data[0];
    }
    async getWeather(cityId) {
        const queryParams =  `${cityId}?apikey=${this.myKey}`;
        const response    = await fetch( this.weatherUrl + queryParams);
        const data        = await response.json();
        return data[0];
    }
}

Built with

  • HTML
  • CSS
  • Vanilla JS

Frameworks

API

Author

Contact me through my social accounts

License

Licensed under the MIT License

About

What Weather is a forecasting weather App that allows you to get the weather conditions of a location you choose. It depends on the API of Accuweather website.

Topics

Resources

License

Stars

Watchers

Forks