JavaScript schema example
context object (used for making references, partials, etc.) are passed in as parameters you can even create unit tests of your schemas if you want to.
Destructuring
You can destruct parameters, so theroutes and properties method in the above example can be simplified to:
JavaScript destruct schema example
Arrow function expression
You can use arrow function expression to simplify or make your schema even more compact:JavaScript arrow function expression schema example
Console object
When debugging JavaScript it’s often useful to use the console object to print out values to the console. When using the Test schema feature in the Enterspeed Management App, the following methods are supported:- debug
- error
- info
- log
- trace
- warn
JavaScript schema with conole usage
Limitations
Now, we said that you have all the power of the JavaScript language available for you in your JavaScript schemas, but we have added some limitations because of security. This means that the following areas has been restricted.- No access to the filesystem
- No network traffic
- Maximum processing time of 60 sec pr schema