Initialize the Project from the CLI

You can now begin working on your Catalyst project from the CLI. The first step is to initialize the project in an empty directory. This will be the home directory of your project, where all of your project files are saved.

You can learn more about this from the Project Directory Structure help page. You can learn about initializing a project in detail from the CLI help documentation.

For the WorkDrive Sync app, we will initialize an Event function in the Java or Node.js environment, and the client component. You can later add an Advanced I/O function in the directory after initializing the project with these resources.

  1. Create a folder for the project on your local machine and navigate to it from the terminal.
  2. Initialize a project by executing the following command from that directory:
copy
$
catalyst init
  1. Select Client and Functions using the space bar. Press the Enter key to initialize. catalyst_workdrive_init_1

  2. The CLI will now ask you to associate a Catalyst project with the directory. Associate it with the project that we created earlier from the console. Select WorkDriveSync from the list and press Enter. catalyst_workdrive_init_2

  3. The CLI will initiate the function setup. Select Event as the function type.
    catalyst_workdrive_init_3

  4. Select the latest runtime of Java as the function stack, and press Enter. catalyst_workdrive_init_4

  5. Java: Enter “WorkDrive” as the folder name and “WorkDriveSync” as the class name. Press Enter each time. The CLI will download and install the latest Catalyst Java SDK package on your local system.

Note:Ensure that you enter the package name, or class name and folder name, exactly as instructed, because the application's code contains the same names.
  1. The CLI will initiate the client set up next. Enter “WorkDriveSyncApp” as the name for the client package and press Enter.

catalyst_workdrive_init_7

You can enter any name you need. However, you can use the same name that you used while enabling Zoho sign-in to maintain standardization.

The client directory will be created in the standard structure. Catalyst initialization is now complete.

Set up the Advanced I/O Function

  1. To add an additional function, execute the following command from the project directory:
copy
$
catalyst functions:add
  1. Select Advanced I/O as the function type and press Enter.

catalyst_workdrive_add_1

  1. Select the latest runtime of Java as the function stack, and press Enter.

catalyst_workdrive_add_2

  1. Java: Enter “file” as the folder name and Files" as the class name. Press Enter each time.

    The CLI will download and install the latest Catalyst Java SDK package on your local system.

Note:Ensure that you enter the package name, or class name and folder name, exactly as instructed, because the application's code contains the same names.

Your project directory is now set up with the client directory (CATALYST_CLIENT_HOME) and the functions directory (CATALYST_FUNCTIONS_HOME) along with configuration files and dependencies. The project directory also contains the catalyst.json configuration file and a hidden catalyst.rc file.

This is the structure of your project directory.

catalyst_workdrive_proj_dir_struct_java

Note: We will add an additional file, login.html, in the client directory later.

Last Updated 2023-12-15 18:54:08 +0530 +0530