meals-made-easy-app/src/app/recipe.service.ts
2025-12-09 12:29:56 -06:00

18 lines
521 B
TypeScript

import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map, Observable } from 'rxjs';
import { Recipe, RecipeInfoViews } from './model/Recipe.model';
@Injectable({
providedIn: 'root',
})
export class RecipeService {
private readonly http = inject(HttpClient);
public getRecipes(): Observable<Recipe[]> {
return this.http
.get<RecipeInfoViews>('http://localhost:8080/recipes')
.pipe(map((res) => res.content));
}
}