import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class WorldBankService {

  private apiUrl: string = "https://api.worldbank.org/v2/country";

  constructor(private http: HttpClient) { }

  public getCountryData(id: string): Observable<any> {
    const url = `${this.apiUrl}/${id}?format=json`;
    return this.http.get(url);
  }
}
