Skip to content

scientific-software-hub/waltz-tango-rest-plugin

Repository files navigation

Build Status GitHub package.json version

Docs

waltz-tango-rest-plugin

npm install @waltz-controls/waltz-tango-rest-plugin --registry=https://npm.pkg.github.com/waltz-controls

Usage

//main.js
const kDummyUser = {
    name: 'tango-cs',
    headers: {
        "Authorization": "Basic " + btoa("tango-cs:tango")
    }
};

const app = new Application();
app.registerContext('user', kDummyUser)
   .registerController(new TangoRestController())
   .registerController(new TangoSubscriptionsController())
   .run()
   
   
//foo.js
const rest = await app.getContext(kTangoRestContext)

//bar.js
const subscriptions = await app.getContext(kContextTangoSubscriptions)

//some other.js
app.middleware.subscribe(kAnyTopic,kChannelTangoRest, subscriber)//listen Tango rest channel
app.middleware.subscribe(kAnyTopic,kChannelTango, subscriber)//listen tango channel

Runtime dependencies

  1. tango-rest-client