Skip to content

Repository files navigation

GlobalWeatherHub 🌍

A dynamic web application that provides real-time weather information for any location on Earth, built as part of an assignment to demonstrate REST API integration using Syncloop. Users can interact with a leaflet map to get detailed weather data for specific coordinates.

Important

Live Application 🔗

Explore the deployed version of GlobalWeatherHub here: GlobalWeatherHub Live Platform

Caution

If you encounter an error message saying "Weather data fetch failed", you may need to update the token used in the server.js file.

  • Open server.js and locate the following line of code:
    const BEARER_TOKEN = 'Replace the existing token with the new one from your SyncLoop API dashboard';
    

Note

Syncloop API Integration 🔌

The Syncloop API, which provides the weather data for this application, is included in the repository. You can download the API package by clicking the link below:

Download Syncloop API Package

Once downloaded, please extract the contents and follow the setup instructions provided in the package to integrate the API into the application.

Note

Syncloop API

  • Custom REST API built on Syncloop
  • Returns comprehensive weather data for specified coordinates
  • Authentication and endpoints are pre-configured in the application

Prerequisites 📋

Before running this application, make sure you have:

  • Node.js (v12 or higher)
  • npm (Node Package Manager)
  • A modern web browser

Tip

Quick Start Guide 🚀

  1. Clone the repository:
git clone https://github.com/coderiders22/GlobalWeatherHub.git
cd GlobalWeatherHub
  1. Install required dependencies:
npm install
npm install express cors path
  1. Start the application:
node server.js
  1. Open your web browser and navigate to:
http://localhost:8000
  1. Add the token to your application**: In the project, find the following line of code in server.js file:

    const BEARER_TOKEN = 'Replace existing token with your token generated through the platform';

    Replace 'Insert Bearer Token Here' with the token you generated from Syncloop API Dashboard.

Once you have added your token, the application will authenticate API requests using that token.

That's it! The application is now running with all necessary configurations set up in the code.

Local API Endpoints

GET /Weather_Info

  • Parameters:
    • lt: Latitude
    • ln: Longitude
  • Returns: Weather information from Syncloop API

GET /

  • Serves the main HTML page

Note

Assignment Overview 📝

This project was created to fulfill the following requirements:

  1. Create REST APIs on Syncloop
  2. Develop a GUI to consume these APIs
  3. Integrate Leaflet JavaScript Map
  4. Implement functionality to:
    • Capture coordinates on map click
    • Fetch weather information using those coordinates

Important

Features 🌟

  • Integration with Syncloop REST API for weather data
  • Interactive map interface using Leaflet.js
  • Real-time weather data fetching
  • Location search functionality
  • Detailed weather information including:
    • Current temperature and conditions
    • Atmospheric conditions (humidity, wind, pressure)
    • Sun and moon information (sunrise, sunset)
    • Local time display
  • Weather alerts for extreme conditions
  • Responsive design with glass-morphism UI
  • Coordinates display for clicked locations

Important

Screenshots 📸

Here are some screenshots of the application:

Desktop Views:

  • Welcome Screen
    This is the first screen that greets users.
    Welcome Screen

  • Before Selecting Map Coordinates
    The screen before any interaction with the map.
    Before Selecting Coordinates

  • After Selecting Map Coordinates
    The updated screen after selecting a location on the map.
    After Selecting Coordinates

  • Features a weather alert system for extreme conditions Alert Message

Mobile & Tablet View:

  • Tablet View
    A responsive view on tablet device.
    Tablet View

  • Mobile View
    A responsive view on mobile device.
    Mobile View

Note

Tech Stack 💪

  • Frontend:

    • HTML5
    • CSS3 with Tailwind CSS
    • JavaScript
    • Leaflet.js for mapping
    • Font Awesome for icons
  • Backend:

    • Node.js
    • Express.js
    • Syncloop API for weather data
    • OpenStreetMap for geocoding

Error Handling ⚠️

The application includes comprehensive error handling for:

  • Invalid coordinates
  • Failed API requests
  • Geocoding failures
  • Network issues

Author ✍️

Manav Rai
Email: manavrai454@gmail.com
College: Punjab Engineering College, Chandigarh


For any additional questions or issues, please open an issue in the repository: https://github.com/coderiders22/GlobalWeatherHub/issues

About

A dynamic web application that provides real-time weather information for any location on Earth, built as part of an assignment to demonstrate REST API integration using Syncloop. Users can interact with a leaflet map to get detailed weather data for specific coordinates.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages