December 2016
Intermediate to advanced
841 pages
17h
English
We still have not shown a forecast yet. We will use data from open weather map (http://www.openweathermap.org). You can create an account on their website. With your account, you can request an API token. You need the token to request the forecast. A free account is limited to 60 requests per second and 50,000 requests per day.
We save the API token in a separate file, lib/config.ts:
export const openWeatherMapKey = "your-token-here"; export const apiURL = "http://api.openweathermap.org/data/2.5/";
Add constants to a separate file
When you add constants in separate configuration files, you can easily change them and your code is more readable. This gives you better maintainable code.
We will create a new file, ...
Read now
Unlock full access