New JS Functions Feature

With Liteflow, you can create services that can have specific tasks, but sometimes what you want is a simple function, and in that case, creating service might be a bit overkill.

# What's new

We added a new feature called "JS Functions".

JavaScript functions are a way to directly execute a task from your workflow without the need to develop a service. This way, your application code base is even simpler. These JavaScript functions can be called from an HTTP endpoint, or the result of a task.

They run in a dedicated environment based on node 12.16, with 256MB of RAM automatically scaled on demand when you need it, so you don't have to worry about its availability.

Functions support async/await features.

JavaScript functions

# Why JS Functions matters

As your application grows, the number of different features grows as well. You often end up having many small features that are different from each other, and in that case cannot be grouped into a dedicated service for it.

Thanks to our JS Functions feature, it is now easier to create such specific behaviors without the need for a "complex" service, reducing the development time and the complexity of your codebase.

It also provides you an environment that you don't need to manage, so you can focus on writing the code for your business logic only. We take care of the rest.

# How to use it

To use the JS Functions feature, you need to create a JavaScript file.

# index.js

module.exports = async (inputs) => {
  const res = await fetch("...");
  // ...
  return {
    result: "hello world",

Then create a workflow to connect this function (in that case to an HTTP endpoint, but it can be anything else).

# liteflow.yml
      - type: trigger
        service: http
        eventKey: request
        endpointKey: my-endpoint
      - type: task
        service: js-function
        taskKey: execute
        handler: ./index.js

This automatically imports your function and deploy it as part of this workflow. Every-time your workflow is triggered, your function is called.

Finally, you can see all the logs of your executions in the Liteflow console.

Make sure to check out the JS Functions documentation.

New to Liteflow? Code and launch your applications quickly with a backend framework and integrated cloud solution. Visualize and manage applications anytime with the console. Sign up for free and deploy your idea in seconds!

play icon developers icon

Liteflow is designed for business

Discover Liteflow

Increase your product development speed

Grow your business faster with the Liteflow Toolkit for Lean Software Development

Sign up for free

No credit card required