This app gets a destination city, departure date and return date from user. Then retrieves data by meking three Api calls asynchronously. First the city name gets passed to Geonames where some data such as Latitude and Longitude will be obtained to be used for the second Api call to Weatherbit server. The weather information varies based on the days left until the departure date, if the trip begins within a week the current weather for the destination will be displayed and if the trip starts beyond a week a forecast for sixteen days will appear on the screen. The app also make another asynchronous Api call to Pixabay to download and display a picture of the travel destination.
- Clone the project
- Install npm
npm installin the root directory where the project is located. By doing that, all the dependencies associated with this project will be installed.
The application will need to make calls to three external servers Geonames, Weatherbit and Pixabay to post and receive data. For security reasons, API keys and usernames are not exposed publicly so you will need to get the credentials from the above mentioned servers. Once the key is obtained, simply create .env file in the root directory and place the key/username in the file as follows:
USER_NAME= "your username for Geonames"
KEY_WEATHERBIT= "your Weatherbit api key"
KEY_PIXABAY = "your Pixabay api key"
The app can be executed from the command line. Depends on what environment you like to run the app, the command would be as such:
- For development mode:
npm run build-dev - For production mode:
npm run build-prod - Then run the server:
npm startOpen the browser and enter:
http://localhost:3000