Sign inSign up

ritesh355/weather-api

By ritesh355

โ€ขUpdated about 1 year ago

A Dockerized Node.js weather API powered by OpenWeatherMap ๐ŸŒฆ๏ธ

Image
Integration & delivery
API management
Developer tools
0

300

ritesh355/weather-api repository overview

โ ๐ŸŒฆ๏ธ Weather API - Node.js + Express + Docker

A simple and powerful Weather API built using Node.js, Express, and Axios, integrated with the OpenWeatherMap API, and containerized using Docker.

Node.js Version Docker Pulls License: MIT


โ ๐Ÿš€ Features

  • ๐ŸŒ Get real-time weather for any city in the world
  • ๐Ÿ”ง Built with Express & Axios for simplicity and performance
  • ๐Ÿ” Environment variable support with .env file
  • ๐Ÿ“ฆ Containerized with Docker
  • ๐Ÿงช Easily extendable for CI/CD or deployment

โ ๐Ÿ“ Folder Structure

weather-api/
โ”‚
โ”œโ”€โ”€ docker/
โ”‚   โ””โ”€โ”€ Dockerfile
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ index.js
โ”œโ”€โ”€ .dockerignore
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ package-lock.json
โ””โ”€โ”€ README.md

โ โš™๏ธ Getting Started

โ 1. Clone the Repository
git clone https://github.com/ritesh355/weather-api.git
cd weather-api
โ 2. Install Dependencies
npm install
โ 3. Setup Environment Variables

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โ 

โ 4. Run with Docker

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

โ ๐Ÿ”Œ API Usage

โ Endpoint
GET /weather?city={cityname}
โ Example
http://localhost:3000/weather?city=delhi
โ Sample Response
{
  "city": "Delhi",
  "temperature": "32.4ยฐC",
  "description": "clear sky",
  "humidity": "45%",
  "wind_speed": "3.5 m/s"
}

โ โœ… Technologies Used

  • Node.js
  • Express.js
  • Axios
  • OpenWeatherMap API
  • Docker

โ ๐Ÿ‘จโ€๐Ÿ’ป Author

Ritesh Singh
๐ŸŒ LinkedInโ  | ๐Ÿ“ Hashnodeโ 


โ ๐Ÿ“„ License

This project is open-source and available under the MIT Licenseโ .

Tag summary

Content type

Image

Digest

sha256:32e79a234โ€ฆ

Size

46.3 MB

Last updated

about 1 year ago

docker pull ritesh355/weather-api