This repository contains two separate implementations of a weather service, one in Java and one in Go. Both services are designed to fetch weather forecast data by interacting with The National Weather Service (NWS) API.
This is a Spring Boot application that provides a RESTful API for retrieving weather forecasts.
- Java Development Kit (JDK) 24 or higher
- Apache Maven
Navigate to the java-weather-service directory and build the project using Maven:
cd java-weather-service
./mvnw clean installAfter building, you can run the Spring Boot application from the java-weather-service directory:
./mvnw spring-boot:runThe application will start on http://localhost:8080.
The weather service exposes an endpoint to get the forecast for a specific geographical point.
Endpoint: GET /weather
Query Parameters:
latitude: The latitude of the location (e.g.,38.9072).longitude: The longitude of the location (e.g.,-77.0369).
Example Request:
curl "http://localhost:8080/weather?latitude=38.9072&longitude=-77.0369"This is a native Go HTTP server that provides similar weather forecasting functionality.
- Go 1.24.4 or higher
Navigate to the go-weather-service directory and build the executable:
cd go-weather-service
go build -o weather-service ./cmd/weather-serviceAfter building, you can run the compiled executable from the go-weather-service directory:
./weather-serviceThe application will start on http://localhost:8080.
The weather service exposes an endpoint to get the forecast for a specific geographical point.
Endpoint: GET /weather
Query Parameters:
latitude: The latitude of the location (e.g.,38.9072).longitude: The longitude of the location (e.g.,-77.0369).
Example Request:
curl "http://localhost:8080/weather?latitude=38.9072&longitude=-77.0369"