Weather Tracker is a web application that allows users to search for the weather conditions of a specific city. The application fetches data from the OpenWeatherMap API and displays it in a user-friendly format.
- Search for the current weather of any city.
- Display temperature in Celsius.
- Show additional weather details such as humidity, wind speed, and rain possibility.
- Display weather icons and country flags.
- Go (version 1.22 or later)
- OpenWeatherMap API key
- Clone the repository:
git clone https://github.com/hamzamaach/weather-tracker.git
cd weather-tracker
- Rename the
.apiConfig.example
file to.apiConfig
and add your OpenWeatherMap API key:
mv .apiConfig.example .apiConfig
Edit the .apiConfig
file to include your OpenWeatherMap API key:
{
"OpenWeatherMapApiKey": "[put your open weather map api key here]"
}
- Run the application:
go run main.go
The application will be accessible at http://localhost:8080
.
- Open your web browser and go to
http://localhost:8080
. - Enter the name of a city in the search box and click the search button.
- The weather information for the city will be displayed.
main.go
: The main Go file containing the server and handler functions.assets/
: Directory containing static assets like CSS files.index.html
: The main HTML template for the web application..apiConfig
: Configuration file for storing the OpenWeatherMap API key.
/
: The main endpoint for searching and displaying weather information.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.
- OpenWeatherMap for providing the weather data API.
- Flagcdn for providing country flag images.
Feel free to reach out if you have any questions or suggestions!