simple-rest-api-client

0.0.4 • Public • Published

Simple REST Api Client

Simple client implementation based on REST Client for Node.js.

Usage

Create config object:

const config = {
    api: {
      host: 'http://localhost/api',
      key: 'dev',
      keyHeader: 'X-Api-Key',
      clientOptions: null // https://github.com/aacerox/node-rest-client#options-parameters
    }  
};

Create client object:

const logger = require('winston'); // or use console object, set null for disable logging
const client = new require('simple-rest-api-client').Client(config, logger);

Call the api method:

client.request('put', '/foo/${id}', {
    path: {id: '78439bb1-1187-43e8-90f6-708e1182a3d6'},
    data: {test: 'hello'}
});

Readme

Keywords

none

Package Sidebar

Install

npm i simple-rest-api-client

Weekly Downloads

1

Version

0.0.4

License

LGPL-3.0

Last publish

Collaborators

  • mikoweb