https://github.com/x42en/net_action
Easy to use Request wrapper in order to interact with RESTful API
https://github.com/x42en/net_action
Last synced: 3 months ago
JSON representation
Easy to use Request wrapper in order to interact with RESTful API
- Host: GitHub
- URL: https://github.com/x42en/net_action
- Owner: x42en
- License: apache-2.0
- Created: 2015-04-23T10:34:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-27T16:24:34.000Z (almost 10 years ago)
- Last Synced: 2025-03-24T06:50:05.473Z (3 months ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Net_action
[](https://nodei.co/npm/net-action/)
Easy to use Request wrapper in order to interact with RESTful API
## Install
Install with npm:
```sh
npm install net-action
```
## Basic UsageRequire the module:
```coffeescript
NETWORK = require 'net-action'
```Instantiate with URL:
```coffeescript
net = new NETWORK('http://localhost/test')
```Execute GET method:
```coffeescript
net.get
ressource: 'hello'
format: 'json'
```Execute POST method:
```coffeescript
net.post
ressource: 'hello/42'
params: { 'hello': 'world' }
format: 'json'
```Execute PUT method:
```coffeescript
net.put
ressource: 'hello/42'
params: { 'hello': 'better world' }
format: 'json'
```Execute DELETE method:
```coffeescript
net.delete
ressource: 'hello/42'
format: 'json'
```## Extended usage
All methods supports success and error callback parameters:
```coffeescript
net.put
ressource: 'hello/42'
params: { 'hello': 'better world' }
successCallback: do_something()
errorCallback: do_another_thing()
```