remote-json
Node.js HTTP/HTTPS client for JSON APIs. Supports GET
, PUT
, POST
, DELETE
and PATCH
methods.
npm install('remote-json')
Usage
var remote = ; ;
API
remote(url[, opt])
Returns a new instance of Remote
object with JSON API's methods.
url
- A full URL string.opt
- A HTTP options object.
Remote.get([path,][data,] callback)
Returns a function for GET
method.
path
- Optional. A path which will be added to the URL.data
- Optional. A data wich will be send with request.callback
- Callback function.
Many paths at one remote:
var remote = ;remote;remote;
Send data on request:
remote;remote;
Remote.[post, put, del, patch]
Usage for these methods is equal to the one of the .get
method.
HTTP JSON Content Types
According to the standard, the MIME media type for JSON text is application/json
. This module checks if the type is valid. You may enable any other type to pass the validation, e.g.:
remotecontentTypes'text/javascript' = true;
HTTP options
Pass it to the constructor:
;
Redirects
This client doesn't follow redirects. Use the follow-redirects
module for this:
remotehttp = http;remotehttps = https;
Tests
npm test
The tests use online services:
They may be down for the momemnt you test this module.