How to hook before execute the method [Server]

How to hook before execute the method
Ex.

Meteor.methods({
    'foo':()=> // hook before call this method (Adding the Middleware for checking user permission)
    {
       //process
    }
});

Thanks

which middleware? in the method you directly have access to Meteor.user() so you can begin with your checks

You can try using validated-methods, there are mixins for what you want to do and you can also create your own.

meteor/validated-method

Thanks. :grinning:

1 Like