Skip to content

lajeff77/Weather-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❤️ Loving you Weather ❤️

📖 About

This React app makes use of the Realtime api from weatherapi.com to display the current temperature and weather condition of a given city. The app also displays the local time using the Timezone api from weatherapi.com.

Type in any city in the search bar to fetch the weather data. The location, temperature, and local time will be displayed.

Learn more about weatherapi.com here.

🔧 The Inner Workings (For the nerds 🤓)

  1. User enters a location into an input field. This location could be a postal/zip code, ip address, latitude/longitude coordinates, or a city name.
  2. User submits the location. The submission calls weatherapi.com twice, once for the Realtime API and another for the Timezone API.
  3. The Realtime API fetches the weather. The response provides us location information such as the city, region, and country. It also provides us the temperature in fahrenheit.
  4. The Timezone API fetches the time based on the name of the city. We receive the timezone name and local time for that city.
  5. The information is displayed on the weather module.

⛺ Setup

  1. Ensure git is installed.
  2. Ensure npm is installed.
  3. Clone this repo with the following command:
https://github.com/lajeff77/Weather-App.git 
  1. Download all the dependencies with the following command:
npm run setup
  1. Email me at lajeff77@gmail.com to receive a copy of my API key or generate your own API key from weatherapi.com. See the getting started section of the docs.
  2. Create a .env file and add your API key
WEATHER_API_KEY = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

🏃🏾 Running Locally

  1. Start the server with the following command:
node server/server.js  
  1. Start the client with the following commands:
cd client
npm start

The server runs on http://localhost:5000 and the client runs on http://localhost:3000.

You can configure the server port in your .env file.

SERVER_PORT = 5001

🔎 Troubleshooting

One of the ports is already in use

Error: listen EADDRINUSE: address already in use :::5000

You need to enter the following commands in order to kill the process running on the port.

sudo lsof -i :<PortNumber>
kill -9 <PID>

See this article: https://codinhood.com/nano/macos/find-kill-proccess-port-macos/

If you see this error for port 5000 on Mac and the kill command doesn't work, check this thread. Control center is known to use port 5000 to scan for airplay: https://developer.apple.com/forums/thread/682332

🔗 Resources

About

a weather app where you can look up the forecast for the day by name of city

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors