-
Notifications
You must be signed in to change notification settings - Fork 8
Routes: Javascript Node
The JS Route
The JS route node is used to implement custom routes in Javascript. These routes process messages based on custom logic or conditions.
This is one of the more important route nodes, as it allows any custom logic to be used to transform the message.
The code block below documents the format for the JS Route node.
"route2": {
"type":"js",
"dependencies":["route1"],
"js": "<inline javascript code>",
"module": "<path to JS code file>",
"my_custom_property":"value_of_this_property"
}
Only one of js
or module
properties must be defined, depending upon whether the routing logic is written in-line or in a separate Javascript module.
If the module
property is used then the module must implement this function
exports.start = (routeName, js, _messageContainer, message) => {
....
....
}
Any custom properties can be passed into the JS route from the flow, and are available to the module via js.my_custom_property
in the function show above, where my_custom_property
is the name of the custom property.
(C) 2018 - 2021 TekMonks