What does Mirage use for an Adapter?


#1

I’m just starting to use Mirage and I couldn’t figure out what adapter it needed. I finally ended up deleting app/adapters/application.js and now everything works. I’ve read through the docs and didn’t see anything about how mirage interacts with the adapter but I’d love to learn more.

Does anyone have any good resources on this?

Thanks!


#2

Mirage doesn’t know anything about your Ember Data configuration; think of Mirage as a mock of your backend server. So, you should use the ED adapter that matches the format of your actual server implementation, and then write your Mirage mocks to match this format.

So if you’re using ActiveModelAdapter, presumably your actual backend is in Rails. You’ll then write your Mirage route handlers to respond to requests in this format: snake_cased attributes, sideloaded relationships etc.

Does that make sense?


#3

Thansk @samselikoff. That does make a lot of sense. Nice way to keep Mirage simple yet bind the mock implementation to what the backend will look like.