The case is as follows, I have a front made in angular and I already managed to make the connection between the back and the database, all this locally ... the problem is the following, when I try to obtain back information from my front with a service using angular http protocol, it is impossible to get localhost information, however I can get it from a virtual back end.
The portion of the code that is annexed is part of the service, front ..
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class DataService {
uri = '';
constructor(private http: HttpClient) { }
getUsers() {
return this.http.get('https://jsonplaceholder.typicode.com/users')
}
getUser(userId) {
return this.http.get('https://jsonplaceholder.typicode.com/users/'+userId)
}
getPosts() {
return this.http.get('https://jsonplaceholder.typicode.com/posts')
}
getPuppies() {
return this.http.get('http://localhost:3000/api/puppies/')
}
of this line for example > return this.http.get (' link ')
I can get data without problem
but of this getPuppies () { return this.http.get (' link ')
} I can not get any information ...
and the nodejs is synchronized with the database understand that when accessing from the browser of localhost: 3000 I get the json of the database created in postgres ... does anyone have any proposal?