November 2019
Beginner
804 pages
20h 1m
English
Create a file called population-service.ts under src/services and add the skeleton to it:
import {PopulationService} from "./population-service.intf";
import {Country, DataPoint} from "../domain";
import {
WorldBankApiV2,
} from "./world-bank-api";
export class PopulationServiceImpl implements PopulationService {
private readonly countriesApiBaseUrl: string;
constructor(baseUrl: string) {
if (!baseUrl || baseUrl.trim().length === 0) {
throw new Error("The base URL must be provided!");
} else if (!baseUrl.toLocaleLowerCase().startsWith('https://') && !baseUrl.toLocaleLowerCase().startsWith('http://')) {
throw new Error("The URL looks invalid. It should start with 'http://' or https://'"); } let ...Read now
Unlock full access