OMG IM ABOUT TO THROW EMBER IN THE FN TRASHCAN AND MOVE ON WITH MY LIFE…
I am using Homestead Vagrant box with the url http://super1.local:8000 I have Ember CLi setup (probably not anymore) so when I would $ ember serve it would load my ember app on my URL http://super1.local:8000/question. Everything was working fine, live reloading worked. I even got my Laravel App to work and tested with Postman. Now nothing is working at all…
I can $ember server after loading up my vagrant box but I cant get any data from my models. I have fooled with the ApplicationAdapter and the config/environmen.js for hours to no avail. SO here is my code right now - and errors
First the errors I get run ember server…
Content Security Policy violation: {“csp-report”:{“document-uri”:“http://super1.local:8000/question",“referrer”:“http://super1.local:8000/question”,“violated-directive”:"script-src ‘self’ localhost:39529 0.0.0.0:39529”,“effective-directive”:“script-src”,“original-policy”:"default-src ‘none’; script-src ‘self’ localhost:39529 0.0.0.0:39529; font-src ‘self’ http://
Now the /adapters/applications.js
import DS from 'ember-data';
//Access configurable values in emberjs ember-cli · GitHub
export default DS.RESTAdapter.extend({
// host: config.apiUrl,
//192.168.10.10
// host: 'localhost',
namespace: 'api/v1'
});
and now for the /config/environment.js (the parts I have been tampering with)
module.exports = function(environment) {
var ENV = {
modulePrefix: 'cherry',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
ENV.contentSecurityPolicy = {
'default-src': "'none'",
'script-src': "'self'",
'font-src': "'self' http://fonts.gstatic.com",
'connect-src': "'self' 127.0.0.1", // Allow data (ajax/websocket) from api.mixpanel.com and custom-api.local
'img-src': "'self'",
'style-src': "'self' 'unsafe-inline'",
'media-src': "'self'"
}
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.constentSecurityPolicy = {
'connect-src' : "'self' localhost:8000",
}
}
I created a model /models/questions.js import DS from ‘ember-data’;
export default DS.Model.extend({
title: DS.attr('string'),
question: DS.attr('string'),
date: DS.attr('date'),
author: DS.attr('string')
});
This is my route /routes/questions.js import Ember from ‘ember’;
export default Ember.Route.extend({
model: function(params) {
return this.store.find('question', params.question_id);
}
});
and my template /templates/questions.js
{{#each question as |que|}}
Author: {{que.author}}
The Question: {{que.title}}
{{/each}}Will someone please help me out on this…I would pay money for help on this, seriously. I am so close to moving onto other routes. I love Ember, it just makes sense to me more than other frameworks, but this configuration for the RestAdapter is killing my excitement. Anyone with Laravel experience would be nice because I would really like to know the de-facto standard for outputting json, right now Im using response->json() and it has been working fine. Im just trying to think of all avenues of why its not working. I can post more code if needed. Please Please Help Me.