This is a simple weather web application built with Node.js, Express, and Docker. It fetches real-time weather data using the OpenWeather API and displays it to users. The app is containerized for easy development.
You can visit it on Render at the link in this repo’s description and test it yourself!
- Fetches current weather data for any city using the OpenWeather API.
- Built with Express.js for fast and lightweight server-side logic.
- Containerized with Docker for consistent environments.
Before you begin, ensure you have the following installed:
- Git
- Docker
- Node.js (optional, for local development without Docker)
- An OpenWeather API key (free tier available)
Clone this repository to your local machine using HTTPS:
git clone https://github.com/whoosh09/weather-check.git
cd weather-checkNote: If you prefer SSH and have SSH keys set up with GitHub, use:
git clone git@github.com:whoosh09/weather-check.gitCreate a .env file in the project root and add your OpenWeather API key:
OPENWEATHER_API_KEY=your_api_key_hereThe app is containerized using Docker for easy setup.
-
Build the Docker image:
docker build -t weather-app . -
Run the container, mapping the app’s port to your host and setting Google’s DNS to avoid
EAI_AGAINerrors:docker run --dns 8.8.8.8 -p 3000:3000 --env-file .env weather-app
--dns 8.8.8.8: Uses Google’s DNS to resolve network issues.-p 3000:3000: Maps port 3000 on your host to the container.--env-file .env: Loads the environment variables from the.envfile.
-
Open your browser and visit
http://localhost:3000to view the app.
If you want to run the app directly with Node.js:
- Install dependencies:
npm install
- Start the app with nodemon:
nodemon index.js
- Visit
http://localhost:3000in your browser.
- OpenWeather API for weather data.
- Express.js for the web framework.
- Docker for containerization.