A simple weather application which shows the current weather and hourly forecasts based on the current geolocation of accessing device.
The following software is required to be installed on your system:
- Node 10.x
- Npm 6.x
Type the following commands in the terminal to verify your Node and Npm versions.
node -v
npm -v
-
Get API keys
-
OpenWeather API
Read the description and specs at OpenWeather API.
Get an API key here.
-
Google Geolocation API
Read the description and specs at Google Geolocation API.
Get an API key here.
-
-
Setup environment variables
It is required to setup a few environment variables that are used by the WeatherService and GeolocationService to authenticate against the above external APIs.
Please follow the following steps:
-
Add '.env' file
Create a file called '.env' at the root of the application.
-
Add environment variables to '.env' file
GOOGLE_GEOLOCATION_API_KEY=PUT_YOUR_API_KEY_HERE OPEN_WEATHER_API_KEY=PUT_YOUR_API_KEY_HERE
-
Add dotenv-webpack setting into Webpack config files
The config files can be found by typing the following command in the terminal.
ls node_modules/react-scripts-ts/config/ | grep webpack.config
For more information about '.env', please visit dotenv-webpack.
-