Request
Installing & Making a Request
To utilize the Request library for node.js, first install the npm module:
$ npm install request
After installing the npm package, you can now create a new instance of the Request client and form a request.
var request = require('request');
var options = {
method: '{{HTTP_METHOD}}',
url: '{{API_URL}}',
headers: {
'x-rapidapi-key': '{{API_KEY}}'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
For more information about using Request, visit their documentation page here.
Updated about 5 years ago