Say, I have the following code:
In app/adapters/instagram.js:
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
urlForQueryRecord(query) {
if (query.friendscount) {
delete query.friendscount;
return `${this._super(...arguments)}/friendscount`;
}
return this._super(...arguments);
}
}
It will go out to http://localhost:20000/instagrams/friendscount to retrieve the data.
How do I make ember.js go out to "http://localhost:20000/socialnetworks/instagrams/friendscount"? (add "socialnetworks" into URI. Note that this "socialnetworks" is before the "instagrams".)
namespace
property can be used to prefix requests with a specific url namespace.
app/adapters/application.js
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
namespace: 'socialnetworks'
});
Refer customizing adapters section in ember guides