Skip to content

Spring Boot application that exposes a RESTful API for retrieving weather forecasts.

Notifications You must be signed in to change notification settings

Flop3r/WeatherForecastAPI

Repository files navigation

Weather Forecast API 🌤️

Project Overview

This project is a Spring Boot application that exposes a RESTful API for retrieving weather forecasts. It utilizes the WeatherAPI service to fetch weather data and presents the forecast.

This project was developed as a business task for a recruitment process at Volvo Group.

Features

  • Weather Forecast: Provides weather forecast for specific location for the next 3 days*.
  • Major Cities in Poland: Includes forecasts for the 5 biggest cities in Poland for the next 3 days*.
*Duration can be changed by query

API Endpoints

More details can be found in the Swagger documentation.

GET /api/v1/forecast

Image: GET /api/v1/forecast

GET /api/v1/forecast/largest-cities

Image:  GET /api/v1/forecast/largest-cities

Swagger Documentation

Swagger documentation is available once the application is running. You can view the API documentation by navigating to:

http://localhost:8080/swagger-ui/index.html

Getting Started 🚀

Clone the Repository

git clone https://github.com/Flop3r/WeatherForecastAPI
cd WeatherForecastAPI

Running the Application

Using Docker (Recommended)

Run Docker Daemon or Docker Desktop

A Dockerfile is provided for containerized deployment. To build and run the Docker container:

docker build -t weather-forecast-api .
docker run -p 8080:8080 weather-forecast-api

Alternatively, you can use docker-compose for building and running the application:

docker-compose up --build

Makefile

You can use the Makefile to build and run the application in Docker container:

make docker

Using Maven

To build the project, use the Maven wrapper included in the repository:

./mvnw clean install

Run the application:

./mvnw spring-boot:run

Makefile

You can also use the Makefile to build and run the application:

make maven

Deployment

For deployment, a deploy.sh script is provided. This script will build and deploy the application using Docker:

./deploy.sh

Configuration

Weather API Key

For presentation purposes, you can omit the process; the latest version of this repository does not require your own API key.

The application requires an API key from WeatherAPI to fetch weather data. You can configure the API key in application.properties:

weatherapi.key=YOUR_API_KEY

Prerequisites

  • Java 17
  • Maven
  • Docker (optional, for containerized deployment)

License

This project is licensed under the MIT License.

About

Spring Boot application that exposes a RESTful API for retrieving weather forecasts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages