Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Be able to apply hooks to custom service methods #9

Closed
ekryski opened this issue Sep 1, 2014 · 3 comments
Closed

Be able to apply hooks to custom service methods #9

ekryski opened this issue Sep 1, 2014 · 3 comments

Comments

@ekryski
Copy link
Member

ekryski commented Sep 1, 2014

I'd like to be able to have a service like so:

var myCustomHook = function(hook, next){
  // do something custom
  next();
};

var CustomService = Service.extend({
    before: {
      customMethod: [myCustomHook]
    },

    customMethod: function(params, cb){
      // Do some custom stuff
      cb();
    }
});

Currently hooks only fire on our default service methods.

@daffl
Copy link
Member

daffl commented Sep 2, 2014

I would think this means removing the check in https://github.com/feathersjs/feathers-hooks/blob/master/lib/before.js#L18 and https://github.com/feathersjs/feathers-hooks/blob/master/lib/after.js#L16 and making sure that the service method exists.

@daffl
Copy link
Member

daffl commented Mar 6, 2015

Closing this one as we discussed in #10 that it doesn't make too much sense (at least currently).

@daffl daffl closed this as completed Mar 6, 2015
@kbrandwijk
Copy link

kbrandwijk commented Sep 28, 2017

I'm sorry to revive this old issue, but has anything changed with regards to this? It still feels useful to be able to attach hooks to any method a service has. Also, ES6 might have offered a few ways by now (like the spread operator) to not needing to know the exact signature of the custom service method?

Update: just found #165, apparently nothing new...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants