I am using below package for demo application
I follow all steps whatever it is written in doc .But getting error
**machineDefinition is undefined
here is my code
var http = require(“http”);
let { MachineDefinition, Machine } = require(“@opuscapita/fsm-workflow-core”);
var machineDefinition = new MachineDefinition({
schema: {
initialState: “start”,
finalStates: [“finish”],
transitions: [{ from: “start”, event: “run”, to: “finish” }]
}
});
const object = { status: “none” };
const machine = new Machine(machineDefinition);
machine
.start({ object })
.then(({ object }) => {
console.log(machine.currentState({ object }));
// start
return machine.sendEvent({ object, event: “start” });
})
.then(({ object }) => {
console.log(machine.currentState({ object }));
// finish
});
//create a server object:
http
.createServer(function(req, res) {
res.write(“Hello World!”); //write a response to the client
res.end(); //end the response
})
.listen(8080); //the server object listens on port 8080
could you please tell me where I am doing wrong .?
One more thing this package is `Apache-2.0