1
My question is: how do I link (baseurl) to which my front-end access the data coming from this database (Postgresql) that is hosted on Heroku?
My Heroku’s Postgresql releases this information:
As the above img I have host, database and so on, now I need to put some of this information in this part of my code front-end (Service - Service) eventosUrl = '???';
to release the data from the Heroku comic:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class EventoService {
//eventosUrl = 'http://localhost:8080/eventos';
eventosUrl = '???';
constructor(private http: HttpClient) { }
listar() {
return this.http.get<any[]>(this.eventosUrl);
}
}
I don’t know if I need to put something in my file application properties since I locally put this to free access to database via Ajax (requests):
FILE application.properties:
origem-permitida=http://localhost:4200
Your frontend should not access the database. If your front knows how to access the database, any user can take this information through the browser and hack your database.
– Murillo Goulart
Look is what I’ve learned, but I can do this integration through the
localhost
, as per the code above. I don’t know how you have this information that you refer to, but a link, i.e., the baseURL. This layer is of service and is not directly in the viwer HTML who treats this is the framework Angular.– Rafael Souza Calearo