common-api
Node API abstraction library.
Usage
Without API Key
var { // api specific setup}; MyAPIprototype = hostname: 'api.domain.com' format: APIFORMATJSON // prefix for all api reqeusts base: '/v1'; MyAPIprototype { // this.call returns a promise. // // The constructed URL for this call would be: // http://api.domain.com/v1/widgets // return this
With API Key in URL
var { // setup thisapi_key = api_key;}; MyAPIprototype = hostname: 'api.domain.com' // use https on port 443 secure: true format: APIFORMATJSON base: '/json/{api_key}' // urlTransform is called after building the request URL. { return url; };