Tadaboard Node.js SDK
Tadaboard Node.js SDK for faster response creation
Note that this is a DEVELOPMENT version, API and everything else can change introducing backward incompatibilities
Install
Save the sdk into your project dependencies
npm install --save-dev tadaboard-node-sdk
Usage
var TB = require('tadaboard');
// Body shuold be a JSON either as string or object
var tb = new TB.response({ requestBody: body, queryDefault: {} });
tb.widget('widgetId', yourData);
// Do the above for each widget you have in your dashboard
// Get the response JSON as either object
tb.toJSON();
// or string
tb.toString();
API reference
Constructor
new TB.response(options)
where options has these properties:
-
requestBody: (String|Object) the request sent from the Tadaboard dashboard, to fetch the current query object
-
queryDefault: (Object) a default objec that will be merged with the request query object for later usage in your code
Response instance
tb.widget(widgetId, data)
-
widgetId: (String) the widget referenced in the dashboard
-
data: (Object|Array) the data values, the structure depends on the widget type, you can read each widget data structure on the docs
tb.toString()
Returns the response JSON encoded string
tb.toJSON()
Returns the response JSON object