This application retrieves historical weather data for a given location and date range using the Open-Meteo API. If the data is already stored in the database, it will fetch it from there; otherwise, it makes an HTTP request to the Open-Meteo API.
- API to fetch historical weather data based on location and date range.
- Uses the Open-Meteo API to retrieve weather information.
- Stores retrieved weather data in the database for faster future access.
Make sure you have the following installed on your system:
- Ruby: Version 3.x or higher.
- Rails: Version 7.x or higher.
- SQLite3 (or another database if configured differently in the project).
- Git: To clone the repository.
git clone <This repository url>
cd backend-weather-app-openmeteo
bundle install
rails db:create
rails db:migrate
Preferably in a different port, as the frontend will be in port 3000. The frontend is ready to receive from port 10524, so:
rails server -p 10524
Fetch historical weather data for a specific location and date range.
Response:
[
{
"id": Numeric,
"location": String,
"date": Date,
"temperature": Float?,
"precipitation": Float?,
"created_at": Datetime,
"updated_at": Datetime
}
]
Due to time constraints, additional enhancements (e.g., more robust error handling, more features) didn't come to fruition:
- A route to return a list of locations with the name of the user's input location - To be able to choose the correct one in the frontend