如何使用 feathersjs 过滤服务?
how to use feathersjs filter service?
您好,我不明白什么是过滤服务以及它是如何使用的。我更新了我的节点、npm 包和所有 node_modules。现在,当我创建新服务时,我得到了新文件,它看起来是:
/* eslint no-console: 1 */
console.warn('You are using the default filter for the users service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
return data;
};
如何使用它以及过滤服务的用途?
过滤器服务用于过滤从您的服务发出的事件。
例如,假设您有会员服务。在您的服务中创建成员时,默认情况下 'created' 事件将发送给所有连接的用户。通过使用过滤器,您可以限制哪些用户接收这些事件——您可能只希望与新成员属于同一组的用户接收该事件。
有关 Feathers 事件的更多详细信息,请参阅此 link https://docs.feathersjs.com/api/events.html
您好,我不明白什么是过滤服务以及它是如何使用的。我更新了我的节点、npm 包和所有 node_modules。现在,当我创建新服务时,我得到了新文件,它看起来是:
/* eslint no-console: 1 */
console.warn('You are using the default filter for the users service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
return data;
};
如何使用它以及过滤服务的用途?
过滤器服务用于过滤从您的服务发出的事件。 例如,假设您有会员服务。在您的服务中创建成员时,默认情况下 'created' 事件将发送给所有连接的用户。通过使用过滤器,您可以限制哪些用户接收这些事件——您可能只希望与新成员属于同一组的用户接收该事件。 有关 Feathers 事件的更多详细信息,请参阅此 link https://docs.feathersjs.com/api/events.html