codeblox.js
This is a required file that will contain your block's function handler. This file must export a default function, which will be invoked by codeblox.
Example:
const codeblox = require('codeblox')
module.exports.default = codeblox((input, options, callback) => {
callback(null, input.toUpperCase())
})
Arguments
input
The input provided to your block. Will be one the input/output types defined here.
options
An object containing the options provided by the user
- Example:
{ Width: 50, Height: 50 }
callback
A function you will invoke to return a response or error.
A successful response has a null first parameter with the response as the 2nd parameter. Examples:
Text output
callback(null, 'Text response')
Dictionary output
callback(null, { foo: 'Dictionary response' })
Boolean output
callback(null, true)
Table output
callback(null, [ { name: 'Tim', age: 30 }, { name: 'Jess', age: 28 } ] )
To send an error, invoke the callback with a non-null first argument:
callback('Something broke')
Node Version
Codeblox supports Node <= 6.10.2. To use Node 7+ features, you can compile your code before publishing. You may want add your source directory to .codebloxignore