I am writing my first Ember application and at this moment, I am trying to use JSON from my API (made in Rails with Rabl), but RESTAdapater does not work. It does not even reach my server! I got this code:
application / adapters / application.js
import DS from 'ember-data'; export default DS.RESTAdapter.extend({ host: 'localhost:3000', namespace: 'api' });
application / models / player.js
import DS from 'ember-data'; export default DS.Model.extend({ name: DS.attr('string'), heightFormatted: DS.attr('string'), heightCm: DS.attr('number'), weightLb: DS.attr('number'), weightKg: DS.attr('string'), birthplace: DS.attr('string'), birthdate: DS.attr('string'), neoId: DS.attr('number'), position: DS.attr('string'), number: DS.attr('string') });
application / routes / player / index.js
import Ember from 'ember'; export default Ember.Route.extend({ model: function() { return this.store.find('player'); } });
app / routes / players.js
import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { return this.store.find('player', params.player_id); } });
Any idea? I think everything is set up correctly.
console.log
[Report Only] Refused to connect to 'http://localhost:3000/api/players' because it violates the following Content Security Policy directive: "connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729".