samedi 19 mars 2016

ember demo ember-cli-mirage doesn't work on server without backend

I'm preparing a demo of my new ember app, temporarily deploying it to a static http server, without a proper backend.

I've configured the project to fetch its data from mirage, and it works nicely locally.

The problem is that when I upload it to my http server, the mirage doesn't seem to be working, and the demo raises:

vendor-1bce2a3….js:11 Error while processing route: activities Ember Data Request GET /activities returned a 404
Payload (text/html)
[Omitted Lengthy HTML] Error: Ember Data Request GET /activities returned a 404
Payload (text/html)
[Omitted Lengthy HTML]
    at new Error (native)
    at Error.r (http://ift.tt/1MhoDDC)
    at Error.n (http://ift.tt/1XCtY9j)
    at e.default.r.default.extend.handleResponse (http://ift.tt/1MhoD6s)
    at c.error (http://ift.tt/1XCtY9l)
    at u (http://ift.tt/1MhoDDE)
    at Object.c.fireWith (http://ift.tt/1XCtYpz)
    at n (http://ift.tt/1MhoDDG)
    at XMLHttpRequest.<anonymous> (http://ift.tt/1XCtYpD)

this is my configuration of mirage:

// app/mirage/config.js
export default function() {

  this.get('/activities', function(db, request) {
    return { 'activity': db.activity };
  });

  this.get('/activities/:id', function(db, request) {
    var id = request.params.id;
    return { 'activity': db.activity.find(id) };
  });
}

it works find on my local machine, but it won't work on the http server, any ideas on how to get the demo to work?

Thanks,




Aucun commentaire:

Enregistrer un commentaire