November 2019
Beginner
804 pages
20h 1m
English
For this next method, we'll start using the Indicators API. Our function accepts two input parameters: a Country object and a date range string. For a production application, the date range would probably require a few safety checks since it must correspond to the World Bank API rules, but we'll be optimistic for now.
First of all, add the following import at the top of the file:
import {WorldBankApiV2Indicators} from "./world-bank-api";
Then, add the following utility function:
getBaseIndicatorApiUrlFor(indicator: WorldBankApiV2Indicators, country?: Country) {
let countryCode = "all";
if(country) {
countryCode = country.id;
}
return `${this.countriesApiBaseUrl}/${countryCode} ${WorldBankApiV2.INDICATORS_API_PREFIX}/${indicator}`; ...Read now
Unlock full access