Show routes managed by Mirage
See original GitHub issueHello
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:
- Created 8 years ago
- Reactions:1
- Comments:9
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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.