I want to work with promises but I have a callback API in a format like:
I’m using the bluebird library and need to make a series of HTTP requests and need to some of the response data to the next HTTP request. I’ve built a function that handles my requests called callhttp(). This takes a url and the body of a POST. I’m calling it like this: var payload = … Read more
This is a short version of my code.
I’m reading this tutorial about Bookshelf. Bookshelf uses Bluebird promises. There’s quite a few examples that look something like this:
How to correctly construct a loop to make sure the following promise call and the chained logger.log(res) runs synchronously through iteration? (bluebird)
I’ve got a rate limiter for an API I am using which allows 20 requests per second. All requests are promise based and the promise will be resolved with the API data once there is a response.
What is the best way to handle this scenario. I am in a controlled environment and I don’t want to crash.
I am still fairly new to promises and am using bluebird currently, however I have a scenario where I am not quite sure how to best deal with it.
I am using node v0.11.14-nightly-20140819-pre on Windows with
Non-Promisified async interfaces –
.promisifyAll() are incredibly useful to handle all those async interfaces that still require plain callbacks and don’t yet return promises – one line of code creates a promisified version of an entire interface.