mercredi 13 septembre 2017

Is it possible to define an alias URI in ember server?

I started developing an ajax application with Ember.js and ember-cli on Windows. The actual server, on which the application will run, answers to HTTP-GET requests for several specific URIs with xml data. In my actual situation, and with my poor knowledge about ember, the only way I have to test if the ajax functionality of my app is working properly, is to build the app, load it on the server and browse it. I would like to be able to define a set of "fake" answers on ember server, in order to be able to test ajax during developing.

I tried to create the equivalent paths I need inside the "public" folder, for example:

The server answers to a GET request for /ajax/stats with xml data, so I created the file public/ajax/stats containing the xml answer I want to receive, and it actually works, but the content-type mime is not the correct one and I receive the answer as plain text. I should name the fake-answer file public/ajax/stats.xml, but if i do that, my app will not get it, because the URI does not correspond anymore to the "real" one.

Is there a way to configure ember server in order to have a custom URI (which must not be a route, of course) corresponding to a given resource? Is there an other way to get this result?

Thanks




Aucun commentaire:

Enregistrer un commentaire