Skip to content

mezoo-adel/weather-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

City Weather Demo

This is a simple weather application that provides real-time weather data for any city. The application is built using HTML, CSS, and JavaScript for the frontend, with a serverless function backend deployed on Cloudflare Pages.

Project Structure

  • public/: Contains the frontend assets (HTML, CSS, and JavaScript).
  • functions/api/: Contains the serverless function that fetches weather data from an external API.
  • .dev.vars: Local environment variables file for Wrangler.
  • .dev.vars.example: An example file for the required environment variables.

Setup

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
  2. Install dependencies:

    This project uses Wrangler to run locally and deploy. Make sure you have it installed and configured.

  3. Set up environment variables:

    Create a .dev.vars file in the root of the project and add your weather API key:

    WEATHER_API_KEY=your_weather_api_key
    

    You can get a free API key from a provider like OpenWeatherMap.

Running Locally

To run the application locally, use the following Wrangler command:

wrangler pages dev public

Deploying to Cloudflare Pages

To deploy the application to Cloudflare Pages, follow these steps:

  1. Deploy the application:

    Run the following Wrangler command to deploy your project:

    wrangler pages deploy public
  2. Configure environment variables:

    After deploying, you need to add the WEATHER_API_KEY to your Cloudflare Pages project.

    • Go to your Cloudflare dashboard.
    • Navigate to Workers & Pages and select your project.
    • Go to Settings > Environment variables.
    • Add a new variable with the name WEATHER_API_KEY and your API key as the value.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors