Initialize Functions
Set up Function Type
If you choose to initialize the Functions directory for your project, Catalyst will initiate its setup process.
-
Select the type of function you would like to develop. Make your selection and press Enter .

The five types of functions that you can develop in Catalyst are: Basic I/O, Advanced I/O, Event, Cron, and Integration functions. To learn more about the function types and their purposes, refer to the Functions help page.
Integration Functions:
The CLI initialization process is the same for all the other function types, except the Integration functions. If you select Integration from the list, you have to perform these two extra steps before moving on to the next step:
i. Select the service that you want to integrate with. You can currently only select Cliq integration.

ii. Select the handlers that you require. You can learn more about this from the Integration Functions help page .
The rest of the setup process is the same for all function types. The process only varies with the function stack.
- Select a stack to develop the server side functions in and press Enter . The list displays all supported runtimes. You can select the latest supported version of either Java or Node.js from the list.
Initialize a Java Function of Any Type

-
If you initialize a Java function, enter the reference name of the Java function when prompted and press Enter . This will also be the name of the function’s folder.

-
Provide the main class name of the Java function and press Enter . The CLI will then download the Java SDK package and complete the function setup process.

The Java function’s folder will be created with the main .java class file, the library JAR files, catalyst-config.json , and other configuration files. These values will be updated in the catalyst.json
configuration file.

You can learn about the Java function directory structure in detail from the Project Directory Structure help page.
Initialize a Node.js Function of Any Type

-
If you initialize a Node.js function, provide a package name for your Node function when prompted and press Enter .

-
Provide the name of the entry point file and press Enter .
-
Provide a name for the function author and press Enter .
-
The CLI will then prompt you to allow installation of node dependencies. Press Y to confirm the installation, and press Enter to confirm your choice. If you don’t install all the required dependencies, it could cause errors during the function’s execution.

The CLI will then download the Node.js SDK package and complete the function setup process.
The Node function’s directory is now set up with the .js main function file, catalyst-config.json , and the necessary node modules and configuration files if you installed the dependencies. These values will be updated in the catalyst.json configuration file.

You can learn about the Node.js function directory structure in detail from the Project Directory Structure help page .
-
You can add any number of sub-folders and files in a Java or a Node.js function’s directory. Besides the main function file, a function’s folder can contain other sub-functions. However, the configuration files and dependencies need to be in the function directory’s root.
-
You can create sub-functions through the Catalyst console , or using external editors. You can also pull an existing function directory from the console to your local system using the catalyst pull command.
-
If you need to initialize more than one function, you can do so by using the catalyst functions:add command.
Initialize a Python Function of Any Type

- If you initialize a Python function, provide a package name for your Python function when prompted and press Enter .
- Provide the name of the entry point file and press Enter.

On successful initialization of the Python function, the Catalyst Python SDK package will be automatically installed for your project and an entry will be made in the requirements.txt file.
The Python function’s directory is now set up with the .py main function file, catalyst-config.json and the requirements.txt configuration file. These values will be updated in the catalyst.json configuration file.

You can learn about the Python function directory structure in detail from the Project Directory Structure help page .
-
You can add any number of sub-folders and files in a Java, Node.js or Python function’s directory. Besides the main function file, a function’s folder can contain other sub-functions. However, the configuration files and dependencies need to be in the function directory’s root.
-
You can create sub-functions for Node.js functions through the Catalyst console . However, Java and Python functions can be created and updated only from the CLI or using external editors.
-
If you need to initialize more than one function, you can do so by using the catalyst functions:add command.
Yes
No
Send your feedback to us