Creating reliable workflows in JavaScript
Jbee - codehooks.io

Jbee - codehooks.io @restdbjones

About: Interested in the Internet, databases, programming and everything in between. Co-founder of restdb.io and codehooks.io. Love to learn and code.

Location:
Norway
Joined:
Nov 25, 2022

Creating reliable workflows in JavaScript

Publish Date: Jun 17
0 0

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

Comments 0 total

    Add comment