Roi is a small Node.js module REST HTTP client.

You must be wondering why another module?

To answer this question, I need to tell you a little about a few demands that have come up in the past.

I am part of a team of projects and research at Red Hat focused on Node.js and JBoss projects. Some time ago, we needed a Node.js client module: for the Apiman project. This client should be simple, using Basic Authentication and would have to expose Promises in the API, like this:

We started using the popular Request along with native Promises from Node.js.

After the first versions of the Apiman client were published, there was a new demand for the implementation of a client for the Drools KIE server. At this point I noticed that both would follow the same format. Then came the curiosity to research and create an API using only the Node.js HTTP module. So the next module clients for future implementations of integration with JBoss projects, could follow along the same lines. This was the main reason for the creation of roi.

Other reasons:

1. The native HTTP Node.js API is not so simple, I mean we end up creating utility classes to avoid DRY and encapsulate details that are not relevant to the business.
2. Request has 20 dependencies, roi uses only one: Fidelity
(Promises implementation faster than native). I mean, it solves the problem and I know whats happens under the covers.
3. node-bench shows roi around 20% faster than request, but we are working on a more realistic benchmark due Promises.


This module is quite simple, basically the features are:

1. get
2. post
3. put
4. del
5. download
6. upload
7. exists
8. postStream – Make a post and manipulate a download (response) using Streams
9. Basic Authentication support
10. Custom header support


The roi response is formed by the body, statusCode and headers. When you are using it, you can choose what to
manipulate. Here’s an example of a GET:

Another example checking if the endpoint exists:

The other methods follow the same way of using see here for more details.

If you are starting a new project and need a really lean HTTP REST client, I believe roi will be a good option.
Because basically you will be using the Node.js HTTP API in a simpler way, and with a faster implementation
Of Promises (Fidelity).

Of course feel free to contribute:

Leave a Reply