sdk-generator

Automated Universal SDK Generation for REST API by JSON config


Keywords
sdk, REST, isomorphic, universal, generator, generic
License
ISC
Install
npm install sdk-generator@1.0.1

Documentation

sdk-generator

Automated Universal SDK Generation for REST API by JSON config

Install

$ npm install sdk-generator

Usage

import sdkGenerator from 'sdk-generator';
const SDK = sdkGenerator({
  getArticles: {
    path: '/articles/:category',
    method: 'GET'
  }
});

const sdk = new SDK('Server URL');

sdk.getArticles({
  body: {}, // Only for POST and PUT request
  params: {
    category: 'Auto'
  },
  query: {
    page: 1
  }
})
  .then(articles => console.log('articles'))
  .catch(err => console.log(err));

Test

To execute tests for the library, install the project dependencies once:

npm install

Then, the tests can be executed:

npm test