Hello All,
In this blog we will discuss about the remote methods of loopback js.
Remote methods are the static methods of a model, It is basically used to perform operations not defined in LoopBack's API functions.
You can define the remote methods in your model.js file.
Below is an example demonstrating the remote methods to be used:-
Example
Person.js
module.exports =function(Person){
Person.greet =function(msg, cb) {
cb(null,'Greetings... '+ msg);
}
Person.remoteMethod(
'greet',
{
accepts: {arg:'msg', type:'string'},
returns: {arg:'greeting', type:'string'}
}
);
};
0 Comment(s)