samedi 25 juillet 2015

Unable to set host on ember-restless RESTAdapter

I am trying to connect ember client app with back-end sending xml data. After investigating the options I am considering to use ember-restless.

In my adapters, I've included the host override, but this is not honored. the rest calls for the back-end are still sent to http://localhost:4200, while I expect them to goto Restless.svc. How do i ensure that the calls are directed to correct backend while using ember-restless?

Please let me know if I am missing anything here.

// adapters/application.js
import Ember from 'ember';
import RL from "ember-restless";

export default RL.RESTAdapter.create({
    host: 'https://localhost:8000/Restless.svc/',
});

// models/sample.js
import RL from "ember-restless";

var Sample = RL.Model.extend({
  name:       RL.attr('string'),
  nextScheduled:   RL.attr('date')
});  
Sample.reopenClass({
  resourceName: 'sample'
});

export default Sample;

// routes/sample/index.js
import Ember from 'ember';
import Sample from '../../models/sample';

export default Ember.Route.extend({
    model: function() {
        return Sample.find();
    },
});

//app.js
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';
import RL from "ember-restless";
import Adapter from './adapters/application'

var App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
    modulePrefix: config.modulePrefix,
    podModulePrefix: config.podModulePrefix,
    Resolver: Resolver,
});

loadInitializers(App, config.modulePrefix);

App.Client = RL.Client.create({
    adapter: Adapter
});

export default App;

Best, Sun




Aucun commentaire:

Enregistrer un commentaire