DEV Community

Jbee - codehooks.io
Jbee - codehooks.io

Posted on

Creating reliable workflows in JavaScript

Using Codehooks.io, creating realiable and durable workflows has never been easier, nothing to learn, just plain JavaScript.

import { app } from 'codehooks-js'
// The workflow definition
const workflow = app.createWorkflow('minimal', 'Minimal workflow example', {
  start: (state, goto) => { goto('end', {...state, message: 'Hello World'}) },
  end: (state, goto) => goto(null, state) // null complete the workflow
})
// A REST API to start a new workflow instance
app.post('/start', async (req, res) => res.json(await workflow.start({prop: 'some value'})))

export default app.init() 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)