Search code examples
ember-cli

Is it possible to ignore Ember CLI's http-mocks proxy server?


I've created some ember g http-mocks, and they live in my ember app under /server.

I'd also like to be able to run my ember cli app, proxying all api requests to localhost:3000.

It seems if /server exists, ember will use it, regardless of the -proxy flag. I found some discussion about a --no-http-mocks flag near the end of this issue, but I don't think there's a formal proposal yet.

Is there any hackish intermediate way to get ember cli to ignore /server, other than by deleting the entire /server directory?


Solution

  • You could probably set up ember-cli to enable/disable http-mock based on an environments.js variable as described here: http://discuss.emberjs.com/t/how-to-disable-http-mock-server-within-environment-config-file/6660

    Then to manually flip http-mock on and off as you like, pass in a process environment variable when you run your ember serve at command line. Seems like the way to do that is in this SO post: How to pass API keys in environment variables to Ember CLI using process.env?