This application is developed as a PWA in VueJS. On initial load, locatin of user is found and weather information is displayed for next 7 days. Weather details are retrieved from darksky API (https://darksky.net/dev). User can search for a city/place weather information as well. To get city/place latitude and longitue, google map geocode API is used (https://maps.googleapis.com/maps/api/geocode/json).
npm install
API keys for darksky and google geocode are placed in .env file. They are excluded from commit. To run locally create a .env file at root folder and define keys VUE_APP_GEOCODE_API_CODE and VUE_APP_DARKSKY_API_CODE
- 7 day forecast based on current location (user has to give permission to share location)
- Summary information, Min and Max temperature of the day and their timings are shown for daily forecast. An icon indicating the summary is also shown.
- Searched result is saved into localstorage for offline usage.
- A red information bar is show if user is not online
- User can search for hourly forecast of selected city which will give data for next 48 hours
- Both daily and hourly information can be searched for any place as long as goole API gives latitude and longitude information
- User can save a city to favourites. This information is saved in localstorage
- User can view cities in current favourites.
- To use the application without CORS issue proxy server needs to be set up (https://darksky.net/dev/docs/faq#cross-origin). NodeJS and Express can be used to do this.
- Users can select city from saved favourites which will give result for the selected city
- Input for city can be replaced with an autocomplete box giving input for valid places from another API
- Styling and overall design of screen can be improved
- Sample pwa with VueJS and Ionic -https://github.com/bradtraversy/zip-info-pwa
- To get coordinates of a location - https://maps.googleapis.com/maps/api/geocode/json
- To get forecast based on coordates - https://api.darksky.net/
- NPM Package manager for vue cli, skycons, vue-offline, vetur - https://www.npmjs.com/ -
- https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9 - darksky API prevents CORS error. This link explains about possible work arounds.
- VueJS (Modern Web Framework) – https://vuejs.org
- VueJSCLI (CLI to create and manage project) – https://cli.vuejs.org/guide/installation.html
- https://firebase.google.com/ -This pwa is deployed in firebase at https://weatherapp-2be90.firebaseapp.com/
- Ionic 4 for styling - https://ionicframework.com/blog/introducing-ionic-4-ionic-for-everyone/