我想在羽毛的前钩子上创建一个过滤器。我想检查数据是否包含此参数,然后不要将此数据保存在集合中。羽毛有可能吗?
这可以通过在context.result挂钩中设置before
来完成。也可以找到更多详细信息in the hooks API:
app.service('users').hooks({
before: {
get: [
context => {
// Never call the actual users service
// just use the authenticated user
context.result = context.params.user;
return context;
}
]
}
});