-
Download and install Node.js latest LTS version
-
Clone the repository
$ git clone https://github.com/funtini/weather-app-chall.git
- Install required dependencies
$ npm install
To run the project in development mode run:
$ npm start
- React 17 - JavaScript library for building user interfaces
- Redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
- RTK Query - An optional addon included in the Redux Toolkit package, which is a powerful data fetching and caching tool
- PostCSS - JavaScript tool for transforming styles with JS plugins
- ESLint - Linting utility for JavaScript
- Babel - JavaScript compiler
- Webpack - Module bundler
- Commits should follow Conventional Commits message conventions
- Using OpenWeather API -- 3 endpoints
[ A ] /data/2.5/onecall - CURRENT WEATHER AND FORECAST by Coordinates
[ B ] /data/2.5/weather - CURRENT WEATHER by Query
[ C ] /geo/1.0/reverse - GEOLOCATION INFO by Coordinates
The use of free OpenWeatherMap API key does not allow us to obtain all information through a single endpoint, so we are forced to triangulate information between them.
- Issues
[A] - It is not able to be called with query parameter and has no info about location (name and country)
[B] - It can be called with query parameter but the response has no info about FORECAST data.
[C] - It is just a geolocation endpoint.
- Solution
CASE 1 - Fetching user current location / default location in first render
Flow:
[ A ] WEATHER and FORECAST -----> [ C ] LOCATION missing info
CASE 2 - Fetching weather by search term
Flow:
[ B ] WEATHER -----> [ A ] FORECAST missing info
- API key
You can find/change API key on .env file persisted as REACT_APP_WEATHER_API_KEY