How make request to MirajeJS js only when I need it

Viewed 132

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 Answers

You can use a passthrough:

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

See MirageJS Passthrough documentation.

Related