npm install @waltz-controls/waltz-tango-rest-plugin --registry=https://npm.pkg.github.com/waltz-controls
//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
- tango-rest-client