Check Live : Weather App
A simple weather application built with React and Vite that fetches and displays the current weather information for a specified city using the OpenWeatherMap API. The app also changes its background image with each weather request using the Unsplash API.
- Fetch and display current weather information for a specified available city.
- Change background image with each weather request using the Unsplash API.
- Responsive design for both desktop and mobile devices.
- React.js
- Vite.js
- OpenWeatherMap API
- Unsplash API
- CSS
- HTML
-
Clone the repository:
git clone https://github.com/NAHIAN-19/weather-app.git cd weather-app
-
Install dependencies:
npm install
-
Obtain API keys:
- Create an account and get an API key from OpenWeatherMap.
- Create an account and get an API key from Unsplash.
-
Create a
.env
file in the root directory and add your API keys:VITE_OPENWEATHERMAP_API_KEY=your_openweathermap_api_key VITE_UNSPLASH_API_KEY=your_unsplash_api_key
-
Run the development server:
npm run dev
-
Open your browser and go to:
http://localhost:5173
- Enter the name of the city you want to check the weather for in the input box.
- Click on the "Get Weather" button.
- The weather information & maps will be displayed along with a new background image.
- If the city is not found, an error page will be displayed with an option to go back.
weather-app/
│
├── public/
│ └── vite.svg
│
├── src/
│ ├── App.jsx
│ ├── main.jsx
│ ├── index.css
│ ├── WeatherMap.jsx
│ └── App.css
|
├── .env
│── .eslintrc.cjs
│── index.html
├── package.json
│── package-lock.json
├── vite.config.js
└── README.md
- OpenWeatherMap for providing the weather data API.
- Unsplash for providing the background images API.
- Vite for the fast development build tool.