fetchArticle(articleId: string): Observable<any> {
return this._http.get(`${this._url}/${articleId}`)
.map((response: Response) => response.json())
.do(value => console.log(value))
.catch((error) => Observable.throw(error));
}
Within the code snippet above, the http.get is making a request to a specific URL:
http://website.com/.json/5
If we want the {articleId}
(which in this case is 5) to be placed before the .json extension, the URL should be structured like this:
http://website.com/5.json