From the course: Building APIs with LoopBack

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Remote methods, remote hooks, or operation hooks?

Remote methods, remote hooks, or operation hooks? - Node.js Tutorial

From the course: Building APIs with LoopBack

Start my 1-month free trial

Remote methods, remote hooks, or operation hooks?

- [Instructor] Okay, so I feel it's important to quickly go over what we've just learned in the last three lessons, given that we've discussed three different types of customizations, remote methods, remote hooks, and operation hooks. So when does it make sense to use one over the other? Just to give you some warning, what follows is mostly personal opinion based on experience, rather than hard and fast rules. First off, if you're building something you want to expose as an API method, for example, get adoptable cats, then remote methods are what you want to choose. And that one's pretty easy. Remote hooks are specifically for customizing an API call, and when you're sure you're only concerned about API calls, this is what you would use. In our example, we decided that the description property added to the cat result only made sense for API customers. That is kind of arbitrary, and you could argue that it would make sense in an operation hook, as well. So on that note, if you want to…

Contents