Search code examples
loopbackjsstronglooploopback

Apply disableRemoteMethod for a lot of models


How I can apply this to all my models?

common/models/task.js

module.exports = function(Task) {

  Task.disableRemoteMethod("upsert", true);
  Task.disableRemoteMethod("updateAll", true);
  Task.disableRemoteMethod("updateAttributes", false);
  Task.disableRemoteMethod('createChangeStream', true);

  Task.disableRemoteMethod("find", true);
  Task.disableRemoteMethod("replaceOrCreate", true);

};

For example, for Project, User etc.


Solution

  • Create a mixin and disable these remote methods there