Server
Install dependencies
Add the necessary dependencies to your project.
npm i @stackhouseos/flower-client-nodejs
Or
yarn add @stackhouseos/flower-client-nodejs
Add Flower to server
import FlowerJS from '@stackhouseos/flower-client-nodejs'
import flow from '../flow-server.json'
const components = {
api: () => [1,2,3,4],
save: () => true
}
const value = {foo:1}
FlowerJS({
components,
elements: flow.elements,
initialData: value,
autoNext: true,
responseAllData: false,
startId: undefined,
}).then(result => {
console.log(result)
})
| Param | Description | optional | default |
|---|---|---|---|
components | Object with the components you want to use within Flower | ||
elements | Array with the elements you want to use within Flower | ||
initialData | Object with the initial data you want to use within Flower | true | |
autoNext | Boolean to enable or disable the autoNext feature | true | true |
responseAllData | Boolean to send reponse responseAllData nodes | true | |
startId | String with the id of the element you want to start with | true |