Create same namespace for a specific set of models instead of creating individual adapters for individual models


#1

How to create different generic adapter for a set of models instead of creating individual adapters for individual models including application level adapter. I have a requirement to merge the sub application project to the same applications.So that the routers namespace should me differentiated.


#2

You could create an adapter that has the configuration you need for one set of models and then just import that adapter and extend it in that model’s adapter.


app/adapters/generic.js

import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
  host: 'http://example.com/'
});

app/adapters/users.js

import GenericAdapter from './generic';
export default GenericAdapter.extend({
});

#3

Hi jhliberty, If there say some 10 models like users,roles, etc. I dont want to create 10 adapters for each.Is there any way to use generic adapter for all 10 model without extended the individual model adapter.