Skip to content

srivastava-diya/Weather-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌤️ Weather API

A simple Node.js-based weather scraping API using Express, Axios, and Cheerio. This API scrapes real-time weather data based on the city provided in the URL.

Installation

  1. Clone the repository:

    git clone https://github.com/srivastava-diya/Weather-API.git
    cd weather-api
    
    
  2. Install Dependencies:

    npm install
    
    
  3. Start the server:

    node index.js
    
    
  4. GET /:city Returns weather data for the specified city.

    Example https://weather-api-xmi6.onrender.com/lucknow

  5. Response in json format:

    {
    "City": "lucknow",
     "DateAndTime": "Sun, May 18 12:57 PM IST",
     "Temperature": "41° C",
     "Temp_min": "28°C",
     "Temp_max": "43°C",
     "Sunrise": "05:17 AM",
     "Sunset": "06:48 PM",
     "Humidity": "21",
     "Pressure": "1002",
     "Longitude": "80.89",
     "Latitude": "26.83"
    }
    
    
  6. Notes This project relies on scraping, which means if the source website structure changes, the API might break.

    Please ensure you have permission to scrape the target website.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published