A bzBond-server Microbond to populate Handlebars templates
On macOs/Linux use the following command to install this Microbond:
/var/www/bzbond-server/bin/install-microbond.sh bzmb-handlebars https://github.com/beezwax/bzmb-handlebars
On Windows Server use the following command to install this Microbond:
powershell -File "C:\Program Files\bzBond-server\bin\install-microbond.ps1" bzmb-handlebars https://github.com/beezwax/bzmb-handlebars
On macOs/Linux use the following command to install this Microbond via a proxy:
/var/www/bzbond-server/bin/install-microbond.sh bzmb-handlebars https://github.com/beezwax/bzmb-handlebars http://proxy.example.com:443
On Windows Server use the following command to install this Microbond via a proxy:
powershell -File "C:\Program Files\bzBond-server\bin\install-microbond.ps1" -Proxy http://proxy.example.com:443
The bzmb-handlebars Microbond provides one route
In a server-side FileMaker script run bzBondRelay
script with parameters in the following format:
{
"mode": "PERFORM_JAVASCRIPT",
"route": "bzmb-handlebars-populate",
"customMethod": "POST",
"customBody": {
// Required. A valid handlebars string
"source": "<p>Hello, my name is {{name}}. I am from {{hometown}}. I have {{kids.length}} kids:</p><ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>",
// Required. A data object to populate the template.
"data": {
"name": "Alan",
"hometown": "Somewhere, TX",
"kids": [
{"name": "Jimmy", "age": "12"},
{"name": "Sally", "age": "4"}
]
}
}
}
A string of the populated template can be accessed via Get ( ScriptResult )
:
JSONGetElement ( Get ( ScriptResult ); "response.result" )