pracowniaapp2Front/src/app/posts.service.ts

18 lines
414 B
TypeScript
Raw Normal View History

2020-01-20 15:02:08 +01:00
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`, )
}
}