Wednesday, 19 April 2017

Remote method with get parameters in url using loopback

i'm trying to add a get remote method to my api using loopback 2.0 in order to achieve the same method structure as the default ones, such as :

/myObject/{id}

The way I've tried is :

  MyObject.remoteMethod(
    'remotemethod', {
      http: {
        path: '/',
        verb: 'get'
      },
      accepts: [
        {arg: 'id', type: 'string'},
      ],
      returns: {
        arg: 'status',
        type: 'string'
      }
    }
  )

But it only allows me to do this :

http://localhost:3000/api/myObject?id=1

Does anyone knows how i can achieve this ?

Does someone also know how i can add a description to this route to display in the explorer ? The documentation doesn't really say much about this.. I think their documentation is not complete, am i the only one who feels that way ?



via Devz

No comments:

Post a Comment