API calls using Node.js examples

Hello all.

I would like to know if someone could point out to examples or perhaps give an example of a typical Web API call done using Node.js

The examples in the documentation are either using cURL or using the direct browser “endpoint”, but usually do not take into account oAuth authentication (e.g. using a token instead of user credentials) and how to wrap all that into a Node.js request.

In the use case of developing a web application, both the “Bearer token” and the following API calls should be done using Node (or say, PHP) and not cURL. So for instance, this example from the documentation should actually exist as a Node request:

curl -H “Authorization: Bearer 07fc551c-806c-41a4-9a8c-10658bd15435” $SERVER/api/26/dataElements.json

Any help would be greatly appreciated.


Antonio Solano.

Broad Institute of MIT and Harvard, Boston, MA, USA.