Angular Services
import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {CardModel} from '../card.model';
@Injectable({
providedIn: 'root'
})
export class DataService {
url = 'http://localhost:3000';
constructor(
private http: HttpClient
) { }
getCards(): Observable<CardModel[]> {
return this.http.get<CardModel[]>(this.url);
}
}