Good morning. I'm making an application in Angular 4 that makes various calls to a Rest API, and that API refers to a database that is on a server. The calls to this API are being made with Angular 4 in the following way:
This is the request made when submitting a form (in this case the Login form):
onSubmit(isValid:boolean){
this._resultado.getLogin(this.inicio_Sesion).subscribe(
result=>{
if(result.count == 1){
localStorage.setItem( 'idUsuario', result.his[0].id);
this._logeado.setValue(true);
this._estado.navigate(['/panelUsuario']);
}else{
this._estado.navigate(['/login']);
}
},
error=>{
var errorMessage = <any>error;
console.log(errorMessage);
}
);
}
And this is the fragment that makes the GET request to the API:
getLogin(data:any){
this.consulta= this.url+"?param%5Bdni%5D=" + data.dni+ "¶m%5Bpwd%5D=" +
data.pwd + "&api_key=API_KEY";
return this._http.get(this.url, {params: data})
.map(res => res.json());
}
The URL variable contains the IP of the server where the Rest API is located. The problem of this is that, if we had the development console in any browser we can see all the data of the Rest API. I suppose that the only way to avoid this would be making this query in a server-oriented language such as PHP or Node JS (I am more interested especially in the latter because I think it will offer more flexibility when working with Angular). The question is, how can I query the API from Node so that the results are taken by Angular 4?
Thank you very much in advance.