A simple and responsive weather application built with vanilla HTML, CSS, and JavaScript that provides real-time weather information using the OpenWeather API.
- Real-time weather data display
- Search functionality for cities worldwide
- Temperature in Celsius/Fahrenheit
- Visual weather conditions
- Additional weather details:
- Humidity
- Wind speed
- Atmospheric pressure
- Min/Max temperature
[Add your live demo link here]
- HTML5
- CSS3
- JavaScript (ES6+)
- OpenWeather API
- Font Awesome Icons
- Google Fonts
- Sign up at OpenWeather
- Get your API key from the dashboard
- Create a
.envfile in the root directory - Add your API key:
WEATHER_API_KEY=your_api_key_here
- Clone the repository:
git clone https://github.com/yourusername/weather-app.git- Navigate to the project directory:
cd weather-app- Open
index.htmlin your browser to view the app.
- Enter a city name in the search box
- Press Enter or click the search button
- View the current weather information:
- Temperature
- Weather condition
- Humidity
- Wind speed
- Pressure
weather-app/
│
├── index.html
├── css/
│ └── style.css
├── js/
│ └── script.js
├── images/
│ └── weather-icons/
└── README.md
const getWeatherData = async (city) => {
const API_KEY = 'your_api_key_here';
const URL = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric`;
try {
const response = await fetch(URL);
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching weather data:', error);
}
};- 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
- 5-day weather forecast
- Geolocation support
- Weather alerts
- Dark/Light theme toggle
- Multiple language support
- Weather maps integration
API Key Issues
- Ensure your API key is valid
- Check if you've reached the API call limit
- Verify the API endpoint URL
Display Issues
- Clear browser cache
- Check console for JavaScript errors
- Verify CSS compatibility with your browser
This project is licensed under the MIT License - see the LICENSE.md file for details.
- OpenWeather API for weather data
- Font Awesome for icons
- Google Fonts for typography
- [Add any other resources used]
