So I'm running an Ember-CLI
and Rails 5
API-only app. It works fine in development when I use the --proxy http://localhost:3000
flag, but now I am trying to deploy to Heroku
.
I have two sides: recipme-ember
and recipme-rails
. Feel free to explore the repos:
So after some struggling I have both sides deployed, but the Ember
app refuses to talk to the Rails app.
When I try to go to the Meal
index I see this in the Heroku
logs:
"GET /meals HTTP/1.1" 200 711 "http://recipme-ember.herokuapp.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/50.0.2661.102 Chrome/50.0.2661.102 Safari/537.36"
Looks like the Ember
app is trying to get the /meals
data from itself.
I have set API_URL env var for my Ember
app to the Rails
Heroku
URL. Not sure if there's something else I need to set.
Thanks in advance!
You need to set the host property for your adapter:
// adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'http://yourapi.herokuapp.com',
});
If you need different hosts for development and production, you can use your config file to change it like shown here.