Skip to content

chocof/kitaro

Repository files navigation

Kitaro

Kitaro provides RPC functionality by using tj's axon. Kitaro can be used to easily develop microservices that interact with each other.

(Still in development, more features coming soon)

Getting Started

Install the module with: grunt build

const { Kitaro }  = require('kitaro');
const kitaro = new Kitaro("myKitaro", 3226);

THe above function will create a new kitaro. To connect with it from another process, machine, universe use

const { RemoteKitaro }  = require('kitaro');
const remote = new RemoteKitaro("127.0.0.1", 3226);

One can add functions to their kitaro

kitaro.addFunction('myFunction', () => true,);
kitaro.addFunction('negate', b => -b,);
kitaro.addFunction('sum3', (a, b, c) => a + b + c,);

These functions can be used by a remote kitaro

const remote.connect()
  .then(listOfFunctions => {
    console.log(listOfFunctions)
    /*
    * [ { label: 'myFunction', returns: 'function' },
    * { label: 'negate', returns: 'function' },
    * { label: 'sum3', returns: 'function' } ]
    */
  })
  .then(async () => {
    console.log(await remote.exec.myFunction())
    // true
    console.log(await remote.exec.negate(3))
    // -3
    console.log(await remote.exec.sum3(1,2,3))
    // 6
  })

Documentation

(Coming soon)

Examples

(Coming soon)

Release History

(Nothing yet)

License

Copyright (c) 2018 chocof Licensed under the MIT license.

About

RPC for NodeJS microservices made easy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published