edjx function build

Builds the sample function after using the function init command.

You must be in the function directory to execute this command, that is, the directory that contains the edjconfig.yaml file.

edjx function build [flag]

Flag

    --target-dir <directory-name>     Optional. Directory to store all generated artifacts. Default directory is "target".

Example

  1. Set the organization ID associated with all EDJX operations.

    root@edjx:~ # edjx config organization -i
    Use the arrow keys to navigate: ↓ ↑ → ←
    ? Select organization:
    ▸ Org2 (4ff1cbdd-ac7a-458a-9a89-619f283a5dda)
    DocsTesting (54fd5c4e-f48c-4579-8bcd-311355d37ca4)

    If no organizations display, create one using the Console.

  2. Create an application.

    root@edjx:~ # edjx application create -n app-org2
    Application created successfully...
    Application ID : 07f424e2-5d7e-4eb6-b1bf-332d64560f49
  3. Set the application ID to be associated with any new functions.

    root@edjx:~ # edjx config application -i
  4. Create a function within the application.
    If you already have the function code, skip to step 4b.

    1. Create the directory and set the function parameters.

      root@edjx:~ # edjx function init project
      Function Name: project01
      ✔ WASM
      ✔ Rust
      ✔ HTTP
      ✔ 30
      ✔ 64
      Setting up project with starter files......
      Project successfully initialized in project directory
    2. Change to the function directory.

      root@edjx:~ # cd project
    3. Open VS Code.

      root@edjx:~ # code .

      VS Code displays the directory and files of your function.

      function build vscode

    4. Modify the code as desired.

      Sample EDJX serverless Rust functions are available in the EDJX Rust source code repo. We advise you to clone this repo when using the EDJX CLI to build and deploy functions.
      See also EDJX Library SDK for Rust.
  5. Execute the build command to build the function based on the .wasm file you created.

    root@edjx:~ # edjx function build
        Finished release [optimized] target(s) in 1.41s
    Project built and wasm file generated successfully at /home/username/project/target/wasm32-unknown-unknown/release/edjfunction_example_rust.wasm