question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show routes managed by Mirage

See original GitHub issue

Hello

I have a rails api, and an ember app that use ember-cli-rails. I want to mock the api only when testing.

Console in browser when running test with ember test --server return me this :

Mirage: Your Ember app tried to GET 'http://www.lvh.me:3000/api/front/696/users?page=1&per=25', but there was no route defined to handle this request. Define a route that matches this path in your mirage/config.js file. Did you forget to add your namespace?

My config.js look like this :

export default function() {
  this.urlPrefix = 'http://lvh.me:3000';
  this.namespace = '/api/front'; 

  this.get('/696/**', function(db, request) {
    return {
      data: {
        type: 'users',
        id: id,
        attributes: db.users
      }
    };
  })
}

I try also with this.get('/696/users/**', function.. and a really simple route handler :

export default function() {
  this.get('http://www.lvh.me:3000/api**');
}

I just have this in my environment.js :

  if (environment === 'development') {
    ENV['ember-cli-mirage'] = {
      enabled: false
    }

I’ve tried also to add this.pretender.get('/*passthrough', this.pretender.passthrough) in my config.js like mention on an another post but it didn’t change my problem.

I’ve ask the question to ember-cli-rails community because I thought it was partially related but it’s not.

PS: I’m using "ember-cli-mirage": "0.1.11",

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

4reactions
JamieWohletzcommented, Oct 25, 2015

I’m having this same issue. I was also looking for a way to view all the URLs that Mirage manages, kind of like rake routes for Rails.

1reaction
cah-brian-gantzlercommented, Oct 27, 2021

Mirage proper has been extracted to MirageJS and this addon it nothing more than a thin wrapper around that, with some additional embery things. For this particular issue, if something were to be done, it would most likely be there. I would suggest you goto MirageJS and open a ticket there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Route handlers - Mirage JS
Route handlers let you define which URLs your Mirage server can handle. The simplest route handler maps a URL to an object:.
Read more >
Mirage JS Deep Dive: Understanding Timing, Response And ...
Route handlers are the Mirage mechanism for intercepting requests your frontend application makes. By default, Mirage will throw an error ...
Read more >
Defining routes - Ember CLI Mirage
To define routes for your server, use the get , post , put and del methods. ... For example, a GET request to...
Read more >
Debugging Ember-cli-mirage when routes are not being called
I have successfully created one route in ember-cli-mirage, ... would make a call to the API that would be intercepted and handled by...
Read more >
How Egnyte Handles API Mocking: A Mirage.js Case Study
It is not handled as well. To make this route handler dynamic, we need to somehow access the data from the in-memory database....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found