api-request-simple
This module wraps the request module for simple REST api interfacing with predetermined hosts
It is meant to be used in situations where you have a finite and predetermined set of hosts which you regularly interact with.
Example
In these cases
var hosts = var api = new hosts var data = foo : "bar"api
replaces
var promise_request = ;var hosts = var data = foo : "bar" // request queue id and trading id from apivar options = method : 'GET' url: "http://" + hosts"host_name" + "/request/path" json : true // default to json qs : data // convert "data" to qsreturn ;
and it particularly shines when you wish to use requests with client-certificates, where :
var hosts = ;var fs = ;var client_cert = cert : fs key : fs ca : fsvar api = new hosts:hosts client_cert : client_cert ; var data = foo : "bar"api;
replaces
var promise_request = ;var hosts = ;var fs = ;var client_cert = cert : fs key : fs ca : fs var options = method : 'GET' url: "http://" + hosts"host_name" + "/request/path" cert: client_certcert key: client_certkey ca: client_certca qs : data // convert "data" to qs;var promise_to_register =