1.0.0 • Published 9 years ago
netto v1.0.0
netto
ネット.js a small helper library for xhr in the browser or Node.js. It is UMD compatible meaning you can use CommonJS/Node.js, AMD, or browser globals.
To install
npm install netto --save
Example
var net = require('netto');
net.root = 'jsonplaceholder.typicode.com';
// If the callback for the get method is null,
// the callback defaults to one similar to the
// the log function
var log = function (err, data) {
if (err) throw err;
else console.log(data);
};
net.get('/posts/1', log);
// returns
// {
// "userId": 1,
// "id": 1,
// "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
// "body": "quia et suscipit
// suscipit recusandae consequuntur expedita et cum
// reprehenderit molestiae ut ut quas totam
// nostrum rerum est autem sunt rem eveniet architecto"
// }
To test In the /netto directory
npm install && npm test
1.0.0
9 years ago