2017-04-30 35 views
1

在我的公司,我們正在重寫大型rails應用程序以使用rails 5 api only模式,並且我正在評估ember.js作爲可能的前端,在單獨的應用程序中使用並由nginx提供服務。我在我的localhost測試中遇到了一個問題,我希望你能建議修補程序或補丁。api調用在網址中具有破折號而不是下劃線

//應用程序/適配器/的application.js

import DS from 'ember-data'; 
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; 
import config from '../config/environment'; 

export default DS.JSONAPIAdapter.extend(DataAdapterMixin, { 
host: ${config.host}, 
authorizer: 'authorizer:jwt', 
namespace: 'api/v1' 
}); 

//應用/模型/設備profile.js

import DS from 'ember-data'; 

export default DS.Model.extend({ 
name: DS.attr('string'), 
devices: DS.hasMany('device'), 
assignedFlags: DS.hasMany('assigned-flag'), 
deviceProfileGpios: DS.hasMany('device-profile-gpio') 
}); 

//應用程序/路由/設備profiles.js

import Ember from 'ember'; 

export default Ember.Route.extend({ 
model() { 
return this.store.findAll('device-profile') 
} 
}); 

當我去http://localhost:4200/device-profiles我得到了我的鐵軌控制檯下面的404錯誤

Started GET "/api/v1/device-profiles" for ::1 at 2017-04-30 08:10:30 -0400 

ActionController::RoutingError (No route matches [GET] "/api/v1/device-profiles"): 

有一些設置,我失蹤或這是一個錯誤?

回答

0

設法找到在燼數據的GitHub網站上的問題

我將此添加到我的應用程序接口答案

pathForType: function(type) { 
    var underscored = Ember.String.underscore(type); 
    return Ember.String.pluralize(underscored); 
} 
相關問題