mercredi 14 août 2019

Adding meta data in ember-cli-mirage route handler

I need to return meta in my ember-cli-mirage route handler data along with the serialised objects in my tests

server.createList('things', 42);

this.get('/things', function(schema, request) {
  return this.serialize(this.schema.things.all());
});

I'd like the route handler to output:

{ data: ..., meta: { 'record-count': 42 } }

Is there a way to set up Mirage to do this or do I need to explicitly set that data on every request?




Aucun commentaire:

Enregistrer un commentaire