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://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:8:14790)
at Error.n (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:19:25963)
at e.default.r.default.extend.handleResponse (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:22:29329)
at c.error (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:22:29898)
at u (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:2:9669)
at Object.c.fireWith (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:2:10437)
at n (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:3:13352)
at XMLHttpRequest.<anonymous> (http://www.my-domain.com/myproject/assets/vendor-1bce2a36ef171f16e76daffe157c9b37.js:3:19180)
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,
By default, Mirage is disabled in production
builds. You can enable it with the ENV option:
// app/config/environment.js
...
if (environment === 'production') {
ENV['ember-cli-mirage'] = {
enabled: true
}
}
See the docs for more info: http://www.ember-cli-mirage.com/docs/v0.1.x/server-configuration/#enabled