How make request to MirajeJS js only when I need it

207 Views Asked by At

I have a fake server created with mirajeJs. All my requests are trying to contact him, how can I make a request for mirajeJs only in cases when I need it while making the rest of the requests to the real server

1

There are 1 best solutions below

0
On BEST ANSWER

You can use a passthrough:

createServer({
  routes() {
    // Allow unhandled requests on the current domain to pass through
    this.passthrough()
  },
})

See MirageJS Passthrough documentation.