shekharpalit / weather-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weather Forecast API with Micronaut

This is a simple weather forecast API built using the Micronaut framework, which allows users to get the weather forecast for a specific day and location. The API makes use of the National Weather Service API to fetch weather data.

Features

  • Retrieve weather forecast for a specific day and location
  • Caching of weather data using Micronaut Cache

Getting Started

Prerequisites

  • JDK 8 or higher
  • Micronaut CLI (optional)

Installation

  1. Clone the repository or download the source code.
git clone https://github.com/yourusername/weather-forecast-api.git
  1. Navigate to the project directory.
cd weather-forecast-api
  1. Build the project.
./gradlew build

Running the application

  1. Run the application using Gradle.
./gradlew run

Alternatively, you can use Micronaut CLI to run the application.

mn run
  1. The API will be available at http://localhost:8080.

Usage

To get the weather forecast for a specific day and location, make a GET request to the /weather/forecast endpoint with the following query parameters:

  • latitude: Latitude of the location
  • longitude: Longitude of the location
  • dayForTemperature: Day for which you want to get the temperature (e.g., "Wednesday Night", "Monday", "Monday Night")

Example request:

GET http://localhost:8080/weather/forecast?latitude=38.8951100&longitude=-77.0363700&dayForTemperature=Wednesday%20Night

Example response:

{
    "temperature": "Temperature on Wednesday Night: 55.0 F"
}

License

N/A

About


Languages

Language:Java 100.0%