如何禁用feather js中的一些方法(get,remove)。
我使用mongodb。
我想禁用所有只允许的方法(post,patch)
发布于 2020-02-20 21:04:01
强制执行此操作的方法是使用before挂钩。
您可以使用feathers-hooks-common中的disallow钩子作为一种(好的)方式。
https://feathers-plus.github.io/v1/feathers-hooks-common/#disallow
const { disallow } = require('feathers-hooks-common');
...
app.use('myservice', ...);
const service = app.service('myservice');
service.hooks({
// only allow create(post) and patch
before: {
get: disallow(),
find: disallow(),
remove: disallow(),
update: disallow()
}
});https://stackoverflow.com/questions/60306116
复制相似问题