A REST API built with Spring Boot that returns real-time weather data for any city using the OpenWeatherMap API.
- Java 21
- Spring Boot 3.5.1
- Maven
- OpenWeatherMap API
- SpringDoc OpenAPI (Swagger UI)
- Get current weather by city name
- Input validation with meaningful error messages
- Global exception handling
- Auto-generated API documentation via Swagger UI
- CI pipeline with GitHub Actions
- Java 21
- Maven
- Clone the repo
git clone https://github.com/eunicepops/weatherapp.git
cd weatherapp- Set your API key
export WEATHER_API_KEY=your_openweathermap_api_key- Start the app
mvn spring-boot:run- Open Swagger UI
http://localhost:8080/swagger-ui.html
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/weather |
Get weather by city name |
{
"city": "Toronto"
}{
"city": "Toronto",
"country": "CA",
"temperature": 15.0,
"description": "clear sky",
"humidity": 80.0,
"windSpeed": 3.5
}mvn testAPI is live on Render:
- Swagger UI: https://weatherapp-1jpu.onrender.com/swagger-ui.html
- Base URL: https://weatherapp-1jpu.onrender.com