Skip to content

x42en/Net_action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Net_action

NPM

Easy to use Request wrapper in order to interact with 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()

About

Easy to use Request wrapper in order to interact with RESTful API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published