API call in Ember


Where does Ember lookup for the URL as below http://localhost:4200/api/bars?id=1

I am using data store this.store.query(‘bar’, {id: 1}),

I am getting a 404 error…so just wondering if I am missing something


The /api/bars is by convention - the /api prefix will have been specified in the application or model adapter: http://emberjs.com/api/data/classes/DS.RESTAdapter.html#toc_endpoint-path-customization

If you want to customize the host (which will default to the “same host” as the Ember app) for your backend you’ll need to change the host property of the adapter - e.g. http://emberjs.com/api/data/classes/DS.RESTAdapter.html#toc_host-customization

// app/adapters/application.js
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  namespace: 'api/',
  host: 'https://api.example.com'