Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Remote Methods in Loopbackjs

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 151
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: