0.0.2 • Published 10 years ago
nett v0.0.2
node-nett
Simplified HTTP request client based on Promise
var nett = require( 'nett' );
var options = { auth: { user: "username", pass: "password" } }; // optional
nett.get( "http://www.example.com", options ).then(
function success( r ) {
console.log( r );
},
function error( err ) {
console.log( err );
}
);
Multiple URLs
nett.get( [ "http://www.example.com", "http://www.example.org" ], options ).then(
function success( r ) {
console.log( r );
},
function error( err ) {
console.log( err );
}
);
POST
nett.post( "http://www.example.com", {foo:"bar"}, options ).then( function success(response){
console.log( response );
}, function error(err){
console.log( err );
} );