Skip to content

RESTful implementation of BusinessNetworkCardStore

Notifications You must be signed in to change notification settings

egorbenko/restful-cardstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful CardStore (Usable but still WIP)

RESTful implementation of BusinessNetworkCardStore

Usage:

const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection;
const RestfulCardStore = require('restful-cardstore')

let cardStore = new RestfulCardStore('http://localhost:3000/cards', options, reponseCallback);
let businessNetworkConnection = new BusinessNetworkConnection({ cardStore: cardStore });

Default options:

// default options
let options = {
  getPath: '',
  putPath: '',
  hasPath: '',
  getAllPath: '',
  deletePath: ''
}

// reponseCallback function gets called on every response
// use this function to locate IdCard inside your response object
// this function needs to return IdCard
// by default callback returns response 'payload'
let reponseCallback = function (apiResponse) {
  return apiResponse.data.payload;
}

let cardStore = new RestfulCardStore('your-api-url', options, reponseCallback);
let businessNetworkConnection = new BusinessNetworkConnection({ cardStore: cardStore });

About

RESTful implementation of BusinessNetworkCardStore

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published