Getting Started with Angular and Rails: API resource URL /api/books.json omits //host:port
Closed this issue · 1 comments
matthewlmcclure commented
The free Getting Started with Angular and Rails, in the section named Step 2: Add an HTTP request to Angular, contains the following code:
this.http.get('/api/books.json')
I believe it should be:
this.http.get('//localhost:3000/api/books.json')
jasonswett commented
@matthewlmcclure Thanks for the suggestion, although I actually want to keep the front end ignorant of localhost:3000
. The main reason is that the production URL will be different. In development, I like to proxy all /api
requests to localhost:3000
in a development-only config file.