Coder Social home page Coder Social logo

mahesh147 / weather-forecast Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 305 KB

A very basic weather forecast app made using React with the help of 3rd party APIs

HTML 5.78% JavaScript 91.35% CSS 2.88%
reactjs redux redux-promise-middleware openweathermap-api axios javascript

weather-forecast's Introduction

Weather-Forecast

What is this repo about?

This repo contains the source code for a web app that displays the weather forecast for any city.

What is the tech-stack?

This web-app was made with React. Redux was used for state management, and Redux-Promise was used as middleware. Axios was used to make API calls.

Where is the weather forecast information collected from?

openweathermap.org has a really good API system in place. This web-app leverages from that.

How do I run this locally on my machine?

  • Download or clone this repo.
  • Navigate to the project folder and run - npm install.
  • To set up the local dev server, run - npm start.
  • Open your browser and navigate to the specified localhost.

Where is the API_KEY?

My API_KEY has been excluded from this public repo. You'll need to use your own API_KEY if you want to run this locally. Go to http://openweathermap.org/api , you'll probably have to signup for an account before you get an API key.

Once you have the API_KEY, add the following line of code to WeatherForecast/src/actions/index.js :

const API_KEY = 'YOUR API_KEY GOES HERE'

How do I fetch the weather forecast data for countries other than India?

By default, the web-app will only fetch weather forecast for places in India, if you want to change it then, edit the following line of code in WeatherForecast/src/actions/index.js :

export function fetchWeather (city) {
                                                                   
	const url = `${ROOT_URL}&q=${city},[ENTER THE COUNTRY CODE THAT YOU WANT TO FETCH WEATHER FORECAST DATA FROM]`;

	...// Rest of the code

}

For example, if you want to change the country to US, then:

	const url = `${ROOT_URL}&q=${city},us';

For Germany, that would be :

	const url = `${ROOT_URL}&q=${city},ge';

...so on and so forth.

NOTE

If you like this project, consider giving it a star. I'd appreciate it. :D

weather-forecast's People

Contributors

mahesh147 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.