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 and all of the project files will be saved in it.
For the Alien City application, we will initialize the client and the Advanced I/O function components. As mentioned earlier, you can code the Advanced I/O function in the Java or Node.js platform, based on your convenience.
- Create a folder for the project on your local machine and navigate to it from the terminal.
- Initialize a project by executing the following command from that directory:
$ catalyst init
- Select Client and Functions using the space bar. Press the Enter key to initialize.
- 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 AlienCity from the list and press Enter.
- The CLI will initiate the function setup. Select AdvancedIO as the function type.
- Select java8 or node10 based on your preference as the function stack.
- If you select node10, enter the "alien_city_function" as the package name, "index.js" as the entry point, and your email address as the author and press Enter. You can press Enter to fill the default values.
The CLI will prompt the initialization of the Node dependencies. Press Y to confirm the installation, and press Enter to confirm your choice. The Node modules will be installed.
If you select java8, enter "AlienCityAIO" as the folder name and press Enter. Enter the same name "AlienCityAIO" as the class name of the Java function as well and press Enter.
The CLI will install the catalyst-java-sdk on your local system and update the information in the configuration file.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.
- The CLI will now initiate the client setup next. Enter "ALcity" as the name for the client package and press Enter. You can enter any name you need.
The client directory will be created in the standard structure. Catalyst initialization is now complete.
Your project directory (CATALYST_PROJECT_HOME) is now set up with the client directory (CATALYST_CLIENT_HOME) and the functions directory (CATALYST_FUNCTIONS_HOME) along with the configuration files and dependencies, along with the catalyst.json and a hidden catalyst.rc file.
This is the structure of the AlienCity project's directory, if the Advanced I/O function is of the Java platform.
This is the structure of the AlienCity project's directory, if the Advanced I/O function is of the Node.js platform.