json-http

1.0.2 • Public • Published

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);      
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    14
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    14
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i json-http

Weekly Downloads

14

Version

1.0.2

License

ISC

Last publish

Collaborators

  • bbraithwaite