heron2014 / weather-redux-app

Weather app build in React and Redux
0 stars 0 forks source link

weather forecast api #4

Open heron2014 opened 8 years ago

heron2014 commented 8 years ago

api - here sign up for api keys

endpoint: api.openweathermap.org/data/2.5/forecast?q={city name},{country code}

to see what data you get from the api call , type:

http://api.openweathermap.org/data/2.5/forecast?q=London,us&appid=yourapikey

to use this url in the application , use es6 template strings syntax (use backtics):

const ROOT_URL = http://api.openweathermap.org/data/2.5/forecast?appid=${API_KEY}

then we can formulate query like this (use backtics):

const url = ${ROOT_URL}&q=${city},uk;

To make a ajax call to the api we can use instead of jquery (which has lots of funtionalities) - use axios