This project is a Go application for fetching, storing, and querying weather data using the OpenWeatherMap API and a PostgreSQL database. The application includes functionality for:
- Weather Data Fetching: Fetches current weather data from the OpenWeatherMap API.
- Data Storage: Stores weather data in a PostgreSQL database.
- Daily Weather Summaries: Computes and stores daily summaries of weather data.
- REST API: Provides endpoints to access weather data and summaries.
- Retry Logic: Handles database connection retries to ensure reliability.
- Go 1.18 or higher
- Docker and Docker Compose
- PostgreSQL
- OpenWeatherMap API key
- Clone the Repository Copy code
- git clone https://github.com/AaryanO2/Weather_Monitor.git
- cd WeatherWatch- Configure Environment Variables
- Create a .env file in the root directory and add your environment variables:
- eg:
POSTGRES_USER=postgres POSTGRES_PASSWORD=yourPassword POSTGRES_DB=codedb DATABASE_URL=postgres://postgres:yourPassword@db:5432/codedb?sslmode=disable - Update the Docker-compose file replace YOUR_API_KEY with OpenWeatherMap API key
- Build and Run the Application
- Using Docker Compose, build and start the services:
- cd server
- docker-compose up --buildThis command will set up the PostgreSQL database and the Go server.
- Open the client folder.
- Click on the index.html file to access the website.