Velocity Docs
  • Welcome
  • Components
    • Manager
    • Windhoek
    • CLI
Powered by GitBook
On this page
  • Installing the CLI
  • Creating a function
  • Listing functions
  • Invoking a function
  • Deleting a function
  1. Components

CLI

The Velocity CLI is currently the only way you can create and invoke Velocity functions. I will be adding custom function invocation URLs pretty soon.

PreviousWindhoek

Last updated 1 year ago

Installing the CLI

Download the precompiled binary for your operating system on the

Creating a function

Let's use the CLI to create a function that just returns hello world. Create a file called function.js and input the following code

module.exports = (args) => {
    return {
        hello: "world",
    }
}

Next, you have to create a zip file containing this code. If you are on windows with poershell, use the following command

Compress-Archive -LiteralPath .\function.js -DestinationPath  code.zip

If you are on Linux/Mac, use the following command

zip code.zip function.js

Next, create a function by running the following command

.\cli.exe create --name demo-func --file-path code.zip --handler function

NOTE: By default, the CLI attempts to connect to my self-hosted Manager API which is definitely not guaranteed to be available. To pass in your custom Manager URL, use the --manager-url flag.

Listing functions

To list all the functions you have deployed, run the following command

.\cli.exe list

Invoking a function

To invoke a function, run the following command

.\cli.exe invoke --name demo-func

Deleting a function

To delete a function, run the following command

.\cli.exe delete --name demo-func
release page