2

I have developed a web app which is a QA forum using mean stack approach. Currently the project is working and I have implemented the basic requirements like login authentication using passportjs, then storing questions, answers, votes etc. in mongodb using mongoose.

Now I am required to add a state machine like workflow programmatically to the entire project where each module (eg.login module) will act as a state. And a flow for them must be defined.

I have looked into javascript workflow engines like workflow-4-node, bpmn.js, turbine.js. So my question is, how should I use these libraries without changing any code of my project, Is there any specific approach to do this, or am I required to change my entire code to implement the work flow.

Also in my project I am using ui.router(Routing module for angularjs) to switch between different pages and controllers (by using $stateProvider). So is this routing that I have implemented, and the state machine like workflow that I am required to do, same(different terminologies but same concept) or are they different?

varad_s
  • 764
  • 1
  • 12
  • 24

1 Answers1

0

NoFlo 0.8 provides a asCallback interface, allowing users to embed NoFlo graphs into existing JavaScript code.

So, if you have defined a NoFlo graph for a particular workflow, you can include it to your JavaScript app like this:

// Wrap a NoFlo graph
var myFunc = noflo.asCallback('my-project/MyGraph');

// Call the wrapped graph
myFunc({
  inport: 'data'
  anotherport: 'more data'
}, function (err, result) {
  // Do something with the result
});
bergie
  • 930
  • 7
  • 8