Weather Api Spring
This project is a web application that allows users to enter a city name and view the current temperature and weather in that city.
The application is built using Spring Boot 3.1.1 and Thymeleaf as the page template engine. It uses JDK 17 and Retrofit as the HTTP client to interact with external APIs.
The NominatimClient API is utilized to obtain the latitude and longitude coordinates of the city, which are then used to fetch weather data from the Seventimer API.
- Docker
-
Clone the repository to your local machine.
-
Make sure you have Docker installed. If not, download and install it from the official website.
-
Run the application using Docker Compose:
docker-compose up -d
-
The application will be accessible at
http://localhost:8080
in your web browser.
-
Open the application in your web browser by visiting
http://localhost:8080
. -
You will see a search box where you can enter the name of the city for which you want to view the weather.
-
After entering the city name, click the "Get Weather" button.
-
The application will use the NominatimClient to obtain the latitude and longitude coordinates of the city.
-
It will then use the Seventimer API to fetch the current weather data based on the coordinates.
-
The weather details, including the temperature and weather conditions, will be displayed on the page.
-
Nominatim API: Used to get the latitude and longitude coordinates of the city based on the city name.
- API Documentation: Nominatim API Documentation
-
Seventimer API: Used to get the weather data based on the latitude and longitude coordinates.
- API Documentation: Seventimer API Documentation
-
Thymeleaf: Page template engine used for rendering HTML templates.
-
Retrofit: HTTP client used for making API calls.
This project is licensed under the MIT License. You are free to use, modify, and distribute the code as per the terms of the license.