I’m trying to get to work EmberCLI frontend app with my Rails API. For some reason it does not work. When I visit ‘localhost:4200/artists’ I see nothing but h1 tag. No API data. JS Console is empty. Any ideas?
Here’s my adapter:
import JSONAPIAdapter from 'ember-data/adapters/json-api';
export default JSONAPIAdapter.extend({
host: 'http://localhost:3000'
});
If your Rails API is on localhost:3000 (at least in local development) and you have your routes under the namespace /api, your adapters/application.js should look like this:
Your template is wrong, you have to loop over model and not artist
{{#each model as |artist|}}
Hello, {{artist.name}}
{{/each}}
This is also the reason why you don’t get any errors in the console. Since the template doesn’t use model, you don’t resolve the promise.
To prevent this in the future: I’d have debugged this with {{log artists}} in my template. Then I’d have seen that {{artists}} is empty and so on…
Hope this helps now!