net-action
v0.1.7
Published
Implement standard net actions
Downloads
1
Maintainers
Readme
Net_action
Easy to use Request wrapper in order to interact with 3L1X1R RESTful API
Install
Install with npm:
npm install net-action
Basic Usage
Require the module:
NETWORK = require 'net-action'
Instantiate with URL:
net = new NETWORK('http://localhost/test')
Execute GET method:
net.get
ressource: 'hello'
format: 'json'
Execute POST method:
net.post
ressource: 'hello/42'
params: { 'hello': 'world' }
format: 'json'
Execute PUT method:
net.put
ressource: 'hello/42'
params: { 'hello': 'better world' }
format: 'json'
Execute DELETE method:
net.delete
ressource: 'hello/42'
format: 'json'
Extended usage
All methods supports success and error callback parameters:
net.put
ressource: 'hello/42'
params: { 'hello': 'better world' }
successCallback: do_something()
errorCallback: do_another_thing()