18 lines
414 B
TypeScript
18 lines
414 B
TypeScript
![]() |
import { Injectable } from '@angular/core';
|
||
|
import {HttpClient} from '@angular/common/http';
|
||
|
const BACKEND_URL = "http://localhost:8001";
|
||
|
@Injectable({
|
||
|
providedIn: 'root'
|
||
|
})
|
||
|
export class PostsService {
|
||
|
|
||
|
constructor(private http:HttpClient) { }
|
||
|
getPosts(page){
|
||
|
return this.http.get(`${BACKEND_URL}/post?page=${page}`)
|
||
|
}
|
||
|
addNewPost(name,text){
|
||
|
return this.http.post(`${BACKEND_URL}/post`, )
|
||
|
}
|
||
|
|
||
|
}
|