Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created November 9, 2020 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blogcacanid/585ed9f774d1fa115a6dcadb2d9ca667 to your computer and use it in GitHub Desktop.
Save blogcacanid/585ed9f774d1fa115a6dcadb2d9ca667 to your computer and use it in GitHub Desktop.
user.service.ts Authentication JWT Angular 9 Lumen 7
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