angular-university / angular-pwa-course

Angular PWA Course - Build Progressive Web Applications
https://angular-university.io/course/angular-pwa-course
MIT License
182 stars 129 forks source link

GET http://localhost:4200/api/lessons 404 (Not Found) #13

Closed michael-letcher closed 3 years ago

michael-letcher commented 5 years ago

I cannot get the proxy to work.

Starting in branch /0-start OS: Mac Broswer: Chrome v73

I keep getting GET http://localhost:4200/api/lessons 404 (Not Found) returned.

I've added "logLevel": "debug" to the proxy and see it logging out [HPM] GET /api/lessons ~> http://localhost:9000.

michael-letcher commented 5 years ago

@jhades Any idea why this would be happening?

I've found if I remove the dynamic API call and directly call the server instead of the proxy redirect then return is successful.

rohankumar1524 commented 5 years ago

As the node server runs on :9000 so you have to prepend the host:port before your APIs. For example, change /api/lessons to http://localhost:9000/api/lessons in service

michael-letcher commented 5 years ago

@rohankumar1524 But that defeats the purpose of the proxy.