ember-cli-mirage-graphql icon indicating copy to clipboard operation
ember-cli-mirage-graphql copied to clipboard

Selective "passthrough" of queries to server

Open knownasilya opened this issue 4 years ago • 2 comments

The issue is that gql is on one endpoint, and if mirage is handling that endpoint how do you do a "passthrough" of select requests to that endpoint.

Maybe if mirage had a passthrough function:

this.passthrough('/api/graphql', (req) => req.body.includes('something'));
this.post('/api/graphql', gql);

Or return this.passAlong() or similar inside the post handler based on logic, where if you return it the request continues to server. cc @samselikoff

knownasilya avatar Jun 01 '20 16:06 knownasilya

Mirage does allow you to supply a callback to passthrough. See https://miragejs.com/api/classes/server/#passthrough. I think this should work.

jneurock avatar Jun 01 '20 19:06 jneurock

Would love to see this, it would make working with graphql in piecemeal possible.

knownasilya avatar Jun 01 '20 21:06 knownasilya