Created
November 9, 2020 21:52
-
-
Save blogcacanid/585ed9f774d1fa115a6dcadb2d9ca667 to your computer and use it in GitHub Desktop.
user.service.ts Authentication JWT Angular 9 Lumen 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
// for Lumen 7 back-end | |
const API_URL = 'http://localhost:8000/api/test/'; | |
// for Node.js back-end | |
// const API_URL = 'http://localhost:9090/api/test/'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class UserService { | |
constructor(private http: HttpClient) { } | |
getPublicContent(): Observable<any> { | |
return this.http.get(API_URL + 'all', { responseType: 'text' }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment