How to get data from differnt port in Ember-cli


#1

how to get data from differnt port in Ember-cli.suppose i am running my ember-cli in 4200, and i need to data from 8080…any one can help me out.


#2

I had to setup cors for this. It was a huge pain in the butt. I added the cors origin and resource headers to my api. Then in my ember app

Ember.$.ajaxSetup(
  crossDomain: true
  xhrFields:
    withCredentials: true
)

#3

Specify the host with port (eg, localhost:8080) in your adapter: http://emberjs.com/api/data/classes/DS.RESTAdapter.html#property_host


#4

If its in development, just set up proxy for your other server (say Rails or Django or w/e you are using).

This proxy will then catch API requests and send them to backend, returning responses back while remaining transparent to both sides…