This project provides a simple weather application that fetches and displays current weather information for a specified city. It utilizes the OpenWeatherMap API to retrieve weather data and presents it in a user-friendly format.
- Search for weather by city name.
- Display temperature, humidity, and wind speed.
- Show weather conditions with corresponding icons.
- Handles errors for invalid city names.
- A modern web browser (e.g., Chrome, Firefox, Safari)
- Basic knowledge of HTML, CSS, and JavaScript
-
Clone the repository:
git clone https://github.com/Mohitpatwari/Weather-API.git
Navigate to the project directory:
bash cd your-repository
Open the index.html file in your browser:
Simply double-click the index.html file to open it in your default web browser. Configuration
Get an API Key:
Sign up for a free API key at OpenWeatherMap.
Add Your API Key:
Replace the apikey variable in script.js with your own API key. javascript const apikey = "your_api_key_here";
Usage:
Enter a city name in the search input field. Click the search button to fetch weather data. View the current temperature, humidity, wind speed, and weather conditions with icons.
Example:
Error Handling If the city name is not found, an error message will be displayed. Ensure the city name is spelled correctly and try again. Contributing Fork the repository
Create a feature branch:
bash Copy code git checkout -b feature/new-feature
Commit your changes:
bash Copy code git commit -am 'Add new feature'
Push to the branch:
bash Copy code git push origin feature/new-feature Create a new Pull Request
License:
This project is licensed under the MIT License.
Acknowledgements:
OpenWeatherMap API for weather data. GitHub for hosting the code repository.