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.
-
Clone the repository:
git clone https://github.com/srivastava-diya/Weather-API.git cd weather-api -
Install Dependencies:
npm install
-
Start the server:
node index.js
-
GET /:city Returns weather data for the specified city.
-
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" } -
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.