Search code examples
ember-cli-mirage

Access to mirage internals (db) in development mode?


I know how to use 'db' to work with internal mirage database in tests but I did not found out if it is possible to access internals like 'db' in standard routes. I understand that my app has no knowledge that mirage is used so it might not be possible.


Solution

  • Mirage's db is passed into route handlers as the first parameter, so you can access it there.

    If you're talking about accessing it within your Ember app's routes (e.g. Ember.Route.extend), this is not really appropriate because Mirage is just a mock for your API and, as you say, your Ember app should have no knowledge of its data other than via XHR requests.