Trying to wrapAsync with Restivus

Hi, i am building a mobile app with Meteor, i’m trying to use restivus to call an async API but I feel kind stupid… Anyone done this and can you provide an example please?

Answering my own question, just figured it out

Api.addRoute 'products', authRequired: false,
  get: ->
    getProducts = ->
      fut = new Future
      Meteor.http.get '', (error, result) ->
        if error
          return console.log(error)
        console.log fut
        fut.return result

    status: 'success', data: getProducts()
1 Like