This post is the continuation of the previous one . What if you want to customize your REST API or add different methods for it? When building an application, you’ll generally need to implement custom logic to process data and perform other operations before responding to client requests. In Loopback there are 3 ways to do this: Adding logic to models Defining boot scripts Defining middleware For this post I'm explaining about the first one, Adding logic to models. There are 3 types to add custom application logic to model. Remote Method Remote Hook Operation Hook Remote Method : A remote-method is nothing but nodejs function mapped to REST endpoints. You can create remote-method by cli or typing by yourself ( click here to know how ). In the previous post, I used memory db. For this one, I'm going to use MongoDB as datasource. You need to install loopback-connector-mongodb to connect to MongoDB. npm install loopback-connector-mongodb --save
The blog represents my thoughts on life and mostly something related to web development.