Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4837

Mirage: Add custom host to adapter issue

$
0
0

@ezy wrote:

I'm using Ember-cli-mirage to mock data. I want to slowly integrate parts of the real api which is located at http://localhost:8000. Ember docs tell me that I should be able to set an adapter so I can have a different host for each model. So I've setup adapters/customer.js with the following:

import DS from 'ember-data';

export default DS.RESTAdapter.extend( {
  host: 'http://localhost:8000',
  namespace: 'api/v1'
});

But when I make the call I'm getting an error

Mirage: Error: Your Ember app tried to GET 'http://localhost:8000/api/v1/customers',
         but there was no route defined to handle this request.
         Define a route that matches this path in your
         mirage/config.js file. Did you forget to add your namespace?

When I run the request without the custom host: adapter it works fine, so I know that mirage is serving the data correctly. But for the customer model I want to use a different host.

I suspect it's something to do with my config/environment.js setup so I'm looking at a variation of https://github.com/samselikoff/ember-cli-mirage/issues/497#issuecomment-183458721 as a potential workaround. But anyone who can shine light on the error or input would be appreciated.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4837

Trending Articles