I followed Angular 2's Tour of Hero tutorial with in memory database. Then I created a Spring backend to supply data and want to integrate Angular2 with Spring's Rest API.
In Tour of Hero I only changed one line of code in hero.service.ts:
/* private heroesUrl = 'app/heroes'; */
private heroesUrl = 'http://localhost:8080/api/hero/all';
The link I changed to is the the Spring service endpoint, if I type the link in browser, it returns JSON data: [{"id":1,"name":"test"}]
.
However, I am getting error in Tour of Hero:
EXCEPTION: Uncaught (in promise): Response with status: 404 Not Found for URL: null
It looks like the spring endpoint of localhost:8080
is not found by Angular application running on localhost:3000
. What could be the issue?