is a simple REST API client
$ npm install rest-proxy
// 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