ga-wdi-boston / ember-deployment-guide

Other
4 stars 19 forks source link

Deployment Guide Lacks Instruction (see body) #2

Closed cuprous closed 8 years ago

cuprous commented 8 years ago

The deployment guide lacks instructions about how to get the deployed ember application to talk to our deployed back end for CRUD actions and authentication actions. We handled this previously by running ember server --proxy address.

faetea commented 8 years ago

Tweaked after a comment by Natalie in this thread

In my deployed Ember App I added API_HOST to Ember config/environment.js

if (environment === 'production') {
  ENV.API_HOST = 'https://shielded-bayou-70737.herokuapp.com';
  ENV.baseURL = '/';
  ENV.locationType = 'hash';
}

Then I had to define a Custom Host in application adapter and the ajax service, because without an adapter defined, your Ember App is looking for an API folder in your current domain, so you need to direct it to the domain where you have hosted your Rails Server.

Added to application adapter:

import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';
import ENV from 'ember-imagegallery/config/environment';

export default ActiveModelAdapter.extend({
  auth: Ember.inject.service(),
  host: ENV.API_HOST,
});

Added to ajax service:

import Ember from 'ember';
import AjaxService from 'ember-ajax/services/ajax';
import ENV from 'ember-imagegallery/config/environment';

export default AjaxService.extend({
  auth: Ember.inject.service(),
  host: ENV.API_HOST,
});

My Deployed Ember App My Ember Repository