A Dockerized Node.js weather API powered by OpenWeatherMap ๐ฆ๏ธ
300
A simple and powerful Weather API built using Node.js, Express, and Axios, integrated with the OpenWeatherMap API, and containerized using Docker.
.env fileweather-api/
โ
โโโ docker/
โ โโโ Dockerfile
โโโ src/
โ โโโ index.js
โโโ .dockerignore
โโโ .env
โโโ .gitignore
โโโ package.json
โโโ package-lock.json
โโโ README.md
git clone https://github.com/ritesh355/weather-api.git
cd weather-api
npm install
Create a .env file in the root directory and add your OpenWeatherMap API key:
OPENWEATHER_API_KEY=your_actual_api_key_here
Get your free API key at: https://openweathermap.org/apiโ
Build the Docker image:
docker build -t weather-api -f docker/Dockerfile .
Run the Docker container:
docker run -p 3000:3000 --env-file .env weather-api
GET /weather?city={cityname}
http://localhost:3000/weather?city=delhi
{
"city": "Delhi",
"temperature": "32.4ยฐC",
"description": "clear sky",
"humidity": "45%",
"wind_speed": "3.5 m/s"
}
Ritesh Singh
๐ LinkedInโ | ๐ Hashnodeโ
This project is open-source and available under the MIT Licenseโ .
Content type
Image
Digest
sha256:32e79a234โฆ
Size
46.3 MB
Last updated
about 1 year ago
docker pull ritesh355/weather-api