0.1.1 • Published 9 years ago
nemento-http v0.1.1
nemento-http
Simple HTTP service (ES6 / ES5) which allow to communication with remote HTTP servers via Fetch API
Install
npm install --save nemento-http
Use
var http = require('nemento-http');
http
.get('http://example.com')
.then(function(result) {
console.log(result);
})
.catch(function(err) {
console.log('[' + err.code + '] ' + err.message);
});
API
http.get(url, config)
http.post(url, data, config)
http.put(url, data, config)
http.delete(url, config)
- url - destination of the request
- config.params - map of values which will be converted to querystring (
?key=value&key2=value2
) - config.headers - map of http headers which will be send to server
- data - data which will be send to server