Skip to content

zeynepyz/travel-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Travel Planner Application

This application helps users plan their trips by fetching relevant weather data and displaying images of the destination. The app utilizes multiple APIs to provide current and future weather forecasts based on the user's travel date and location.

Table of Contents

Overview

This travel application accepts a location and departure date from the user and returns:

  1. Current Weather Forecast if the trip is within a week.
  2. Predicted Weather Forecast if the trip is in the future.
  3. Image of the travel destination.

Key Features:

  • Fetches weather data using the Weatherbit API.
  • Retrieves coordinates for the location from the Geonames API.
  • Displays images of the travel destination using the Pixabay API.

APIs Used

1. Geonames API

2. Weatherbit API

3. Pixabay API

How It Works

  1. The user submits a location and a departure date via a simple form.
  2. The app sends the location to the Geonames API to retrieve the geographical coordinates (latitude and longitude).
  3. Based on the proximity of the departure date:
    • If the trip is within 7 days, the app fetches the current weather forecast using the Weatherbit API.
    • If the trip is more than 7 days away, it fetches the predicted forecast from the same API.
  4. The app sends the location name to the Pixabay API to retrieve an image of the destination.
  5. All this data (weather and image) is displayed to the user.

Installation

Prerequisites:

  • Node.js v22 (for running JavaScript)
  • API keys for Geonames, Weatherbit, and Pixabay (sign up on their respective websites to get these).

Steps:

  1. Clone the repository:
    git clone https://github.com/yourusername/travel-planner.git
  2. Install dependencies: npm install
  3. Set up environment variables: Create a .env file in the root directory. Add the following keys with your API information: GEONAMES_USERNAME=your_geonames_username WEATHERBIT_API_KEY=your_weatherbit_api_key PIXABAY_API_KEY=your_pixabay_api_key
  4. Run the application: npm start

Testing

This project uses Jest and Supertest to ensure that the Express server works correctly. Follow the steps below to set up and run the tests.

Setting Up the Test Environment

  1. Install Jest and Supertest

    You need to install Jest and Supertest in your project. Run the following command in your terminal:

    npm install --save-dev jest supertest
    
  2. Run the Test Command Run the tests using the following command in your terminal: npm test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published