Skip to content

Instantly share code, notes, and snippets.

@dujo-stack
Created September 27, 2019 06:44
Show Gist options
  • Save dujo-stack/adc8e8c9967349bf7470618edeaf176e to your computer and use it in GitHub Desktop.
Save dujo-stack/adc8e8c9967349bf7470618edeaf176e to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { BehaviorSubject, Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ArticleService {
private baseUrl = 'http://localhost:3000'
constructor(private http:HttpClient) { }
public get_articles() : Observable<any> {
return this.http.get(this.baseUrl+'/article');
}
public create_article(article: Object) : Observable<Object> {
return this.http.post(this.baseUrl+'/article', article );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment