0

我创建了一个服务,它使用 sequelize (mySQL) 作为名为“person”的数据库。一旦我通过 @feathersjs/feathers 从 Angular 应用程序获取数据,它就可以工作,但是一旦我从 Postman 删除或修补一些数据,feathers 只返回更新的数据。

一旦我从 Postman 修补数据,这里是从 feathersjs 返回的对象 ,我得到状态 200 OK,但在 Angular 应用程序中,我只看到修补的数据。

邮递员补丁示例

返回修补对象的最终结果

person.hook.js 是空的,没有配置钩子:

module.exports = {
  before: {
    all: [  ],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  after: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  error: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  }
};

我尝试使用羽毛聊天客户端和服务器示例,它工作正常,可能是因为它使用内存作为数据库......

感谢您对我的帮助!

4

1 回答 1

0

问题解决了:

问题是在 configure(feathersRx(){idField: '_id'} 上的 feathers.service.ts文件(已从示例聊天应用程序复制)中的 id 字段错误。它应该是正确的,没有下划线。

我的 feathers.service.ts 构造函数现在看起来:

  constructor() {
this._feathers
  .configure(feathersSocketIOClient(this._socket))  // add socket.io plugin
  .configure(feathersAuthClient({                   // add authentication plugin
    storage: window.localStorage
  }))
  .configure(feathersRx({                           // add feathers-reactive plugin
    idField: 'id'
  }));

}

于 2019-09-21T11:41:03.280 回答