If I try to call a get on my nodeJS than it's work but I get different values. I have to submit my search parameters 1-3 times to get the right output. My Node server get the right search parameter and output the right API response but if I want to print it to my Angular app then it will use a old parameters. I don't understand the behavior.
Request Path: angular -> nodeJS -> 3rd partie API -> nodeJS -> angular
Is that path wrong? how can I get the current data for angular?
APP.JS
app.get('/url', (req, res) => {
var name = req.query.searchname;
console.log("Output\n---------------------------")
console.log(req.query.searchname);
doGetRequest(name);
return res.send(data);
})
test.service
test(searchName){
this.http.get<any>('http://localhost:3000/url', {
params: {
searchname: searchName
}}).subscribe(data => this.totalAngularPackages = data)
this.log();
}
log(){
console.log(this.totalAngularPackages);
}