Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-method hooks #397

Closed
bajtos opened this issue Jan 19, 2015 · 2 comments
Closed

Per-method hooks #397

bajtos opened this issue Jan 19, 2015 · 2 comments
Assignees

Comments

@bajtos
Copy link
Member

bajtos commented Jan 19, 2015

A follow-up for #367.

As a LoopBack user, I want to execute my custom piece of code before/after a particular method is executed.

  • the handler is async
  • the handler can change input arguments and/or result (arguments passed to the callback)
  • both static and prototype (instance) method can be overriden
  • handlers are inherited by subclassed models

@raymondfeng suggested using a ctx object instead of a list of arguments in the handler

@ritch
Copy link
Contributor

ritch commented Nov 29, 2016

@bajtos - reopen if this shouldn't be closed.

@bajtos
Copy link
Member Author

bajtos commented Jul 10, 2017

For anybody coming to this issue: we don't support per-method hooks, at least not at the level provided by Model class from loopback-datasource-juggler. There are other ways how to achieve this functionality, for example by using strong-remoting's before/after hooks, or by using a 3rd party library that can wrap model methods contributed by connectors into proxies allowing injections of custom code.

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

No branches or pull requests

6 participants