I am trying to retrieve a json from another microservice (local) using a different port. I am not sure if the issue is with my config or the microservice. When I hit the url I do get the json to display on the page.
this.http.get('http://localhost:8081/*****', { responseType: 'json' }).subscribe(data => console.log(data));
*****
= page where to retrieve the json
I am expecting a json however I get an error message.
For anyone having the same issue I have found my mistake. The controller on the other micro service was missing @CrossOrigin just before the RequestMapping. that fixed my error on the front end where the call was being made.
@CrossOrigin
@RequestMapping("/{id}")
public Account retrieve(@PathVariable Long id) {
// ...
}