Skip to content

jansenzjh/WeatherJavaVsGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Weather Service Implementations (Java vs. Go)

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.

1. Java Weather Service

This is a Spring Boot application that provides a RESTful API for retrieving weather forecasts.

Prerequisites

  • Java Development Kit (JDK) 24 or higher
  • Apache Maven

Building the Project

Navigate to the java-weather-service directory and build the project using Maven:

cd java-weather-service
./mvnw clean install

Running the Application

After building, you can run the Spring Boot application from the java-weather-service directory:

./mvnw spring-boot:run

The application will start on http://localhost:8080.

API Usage

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"

2. Go Weather Service

This is a native Go HTTP server that provides similar weather forecasting functionality.

Prerequisites

  • Go 1.24.4 or higher

Building the Project

Navigate to the go-weather-service directory and build the executable:

cd go-weather-service
go build -o weather-service ./cmd/weather-service

Running the Application

After building, you can run the compiled executable from the go-weather-service directory:

./weather-service

The application will start on http://localhost:8080.

API Usage

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"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published