Problem with mirage on apache server


#1

Hi, I have a simple ember application on a apache server. This application work perfectly on local but when i put on the server I have a problem with the login. My application use mirage is only for testing, so mirage work on local but not online seems for this function.

I have a app/service/auth.js that call mirage

return this.get(‘store’).queryRecord(‘user’, { filter: { email: user } }).then(function(users) {

in mirage I have in config.js this function

this.get(’/users’, function(db, request) { let users = [];

if(Ember.isEmpty(request.queryParams)) {
    users = db.users;
} else {
    let email = request.queryParams['filter[email]'];

    users = db.users.where({email: email});
}

return {
    users: users
};
});

PROBLEM: http://88.198.133.195/users?filter[email]=alessiovavalta%40gmail.it 404 (Not Found)

I don’t understand why…in local work…Thanks in advance for advice


#2

If I understand correctly you want mirage to run in production, besides local, right?

http://www.ember-cli-mirage.com/docs/v0.1.x/server-configuration/

By default, your Mirage server will run in test mode, and in development mode as long as the --proxy option isn’t passed.

For example, to enable in production (e.g. to share a working prototype before your server is ready):

// config/environment.js … if (environment === ‘production’) { ENV[‘ember-cli-mirage’] = { enabled: true } }


Mirage will **ONLY** work in testing mode and in development mode (without ```--proxy``` option passed). In production mode there is no need to run mirage, since it is expected that you provide valid service endpoints. If you still need to run mirage in production mode too, you should manually enable it.

So there you have it, use that code block to enable mirage in production mode. Hope this answers your question.

#3

Thanks for the reponse. I don’t know exactly the problem because I have not impelemented the login but the rest of application. Now this work maybe the cache , i don’t know probably there is a little problem. Thanks