https://github.com/axway-api-builder-ext/javascript-examples
Contains a few javascript examples that might be used in a flow
https://github.com/axway-api-builder-ext/javascript-examples
Last synced: 4 months ago
JSON representation
Contains a few javascript examples that might be used in a flow
- Host: GitHub
- URL: https://github.com/axway-api-builder-ext/javascript-examples
- Owner: Axway-API-Builder-Ext
- License: apache-2.0
- Created: 2019-12-09T16:55:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-10T10:02:36.000Z (over 6 years ago)
- Last Synced: 2025-05-16T20:42:14.179Z (about 1 year ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API-Builder Javascript Flow-Node examples
The Axway API-Builder Javascript-Flow node provides you flexibility as API-Builder is using Javascript-Objects under the hood.
The examples listed on this page should help you to make easily use of it for some use-cases.
## Overview
- [Rename Key in a Java-Script Object](#rename-key-in-a-java-script-object)
- [Trace message to console](#create-a-trace-message)
---
## Examples
### Rename Key in a Java-Script Object
If you would like to rename an existing Javascript-Object key, for instance before converting it back to a JSON-String you can use the following code:
```javascript
async function code(data) {
Object.defineProperty(data, "newKey",
Object.getOwnPropertyDescriptor(data, "oldKey")
);
delete data["oldKey"];
return data;
}
```
### Create a Trace message
In the Javascript Flow-Node turn on the `Unsafe Mode` and with that you can log message to the console:
```javascript
async function code(data) {
console.log("Your message to log")
}
```