Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rest-proxy

aorlic12ISC0.0.9

is a simple REST API client

readme

rest-proxy

is a simple REST API client

install

$ npm install rest-proxy

use

// require nad configure the proxy
var my-api = require('rest-proxy').create({
    baseUrl:            "example.com/api/",
    isSSL:              true,
    authentication: {
        type: "basic",
        defaultCredentials: {
            user:       "admin-user",
            password:   "admin-pass"
        }
    }, 
    services: {
        getMyResources: {
          method: "get",
          url: "myresources",
          success: 200
        },
        getMyresourceById: {
          method: "get",
          url: "myresources/{id}",
          success: 200
        }
    }
});


// call a service (in this case GET example.com/api/myresources/101)
my-api.invoke("getMyresourceById", {id:101}, null, function(err, res_body, res_details) {
    // do something with the received data
});

license

ISC