Cork is a minimal layer that sits on top of the request module and adds a few patterns that make working with 3rd party APIs simpler.
npm install cork
var cork = ;// First, let's register a new service with the name "buzz" and a few defaultscork;// Next, let's make a request based on that servicecork;// Neato! But let's say we want to create another request and override some of the defaultscork;
A base URI can be defined during registration by passing the optional
When registering a service, Cork accepts an optional
throttle parameter which represents a request limit expressed in milliseconds. Any requests that subsequently hit the throttle limit will be queued and processed in FIFO order. For example, let's say that we are working with an API that only accepts 10 requests per second: