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"):
有一些设置,我失踪或这是一个错误?