Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

json-http

bbraithwaite22ISC1.0.2

Simple HTTP wrapper for Node.js http module

node.js, http, wrapper

readme

json-http

A simple wrapper for making an http get request to a JSON endpoint in Node.js. Includes the ability to set a timeout.

var jsonHttp = require('json-http');

jsonHttp.getJson('http://localhost/api', function(err, response) {
    console.log(response);      
});

Using Timeout

var jsonHttp = require('json-http');
var timeoutInMilliSeconds = 2000;

jsonHttp.getJson('http://localhost/api', timeoutInMilliSeconds, function(err, response) {
    console.log(response);      
});