Http-mock and http-proxy—Difference between and usage of


#1

http-mock and http-proxy are both available as blueprints within Ember CLI. This is how I first became aware of them.

I have http-mock working now in my test application by hardcoding the XHR request on the model hook of the Route (I’m not using Ember Data right now in order to better understand how Ember works).

I’m sensing hard-coding the requests like this is bad practice. How could this app be deployed into production? I’d have to manually replace all of my XHR requests.

Can I leave my actual XHR requests in my app as they would be in production (pointing to a production server), and use http-proxy to intercept those calls and replace with the mock server? Is this the problem http-proxy is there to solve?

Am i getting any of this right? Couldn’t find docs on http-proxy.


#2

You might also be interested in ember-cli-pretender.