angular-tour-of-heroes gives 404 for 'api/heroes"

737 Views Asked by At

Just started learning angular development. Following official angular doc from angular.io. Everything was working fine step by step till I reach https://angular.io/tutorial/toh-pt6

Added HttpClientInMemoryWebApiModule for mocking remote server, now it's not working.

here is browser console logs: enter image description here

It's now able to find out 'api/heroes' endpoint. this may be configuration issue with 'HttpClientInMemoryWebApiModule'.

Here is my source code: https://github.com/csankhala/angular-tour-of-heroes

Please let me know what I missed?

1

There are 1 best solutions below

1
Gérôme Grignon On BEST ANSWER

Your urls must matchs the name of your data declared inside the in-memory-data.service.

In this situation, in order to query api/heroes, the createDb() function returned object must include a variable named heroes (rather than HEROES).