net-action

0.1.7 • Public • Published

Net_action

NPM

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()

Package Sidebar

Install

npm i net-action

Weekly Downloads

0

Version

0.1.7

License

Apache v2.0

Last publish

Collaborators

  • x62en