0.0.9 • Published 6 years ago

rest-proxy v0.0.9

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

rest-proxy

is a simple REST API client

install

$ npm install rest-proxy

use

// require nad configure the proxy
var my-api = require('rest-proxy').create({
    baseUrl:            "example.com/api/",
    isSSL:              true,
    authentication: {
        type: "basic",
        defaultCredentials: {
            user:       "admin-user",
            password:   "admin-pass"
        }
    }, 
    services: {
        getMyResources: {
          method: "get",
          url: "myresources",
          success: 200
        },
        getMyresourceById: {
          method: "get",
          url: "myresources/{id}",
          success: 200
        }
    }
});


// call a service (in this case GET example.com/api/myresources/101)
my-api.invoke("getMyresourceById", {id:101}, null, function(err, res_body, res_details) {
    // do something with the received data
});

##license ISC

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

8 years ago