Catalyst Serve Options

Catalyst CLI enables a variety of options that you can use with the catalyst serve command.

--http <port>

You can serve the resources locally in any port you require, other than the default port 3000. You can do this by using the --http option and including the port number where you need the resources to be served from.

For example, to serve your resources from port 2000, execute the following command from your project directory:

copy
$
catalyst serve --http 2000

Catalyst Serve Options


--debug <type:port>

Catalyst enables you to start the local server in the debug mode and attach a debugger to the live server. You can debug the code of your Basic I/O and Advanced I/O functions of your project. You can associate the server to a debugger instance of your IDE that you use to develop the code with. This allows you to debug the execution of your functions, and identify the errors and issues in the code.

Note: The catalyst serve –debug command is only available for Java and Node.js functions, and is not supported for Python functions. You can use a Python IDE for this purpose, and attach a local debugger to it. You can then serve the Python function and test it locally. Refer to this help page for detailed steps to debug and serve Python functions.

You can also choose to start the server at a port of your choice similar to the –http<port> option. The default port where Basic I/O functions are attached to the debugger is 8010 and Advanced I/O functions is 8000.


You can start the local server in the debug mode by executing the following command from the project directory:

copy
$
catalyst serve --debug <advancedio:name:port,basicio:port>

You have to specify the name of the Advanced I/O functions while using this option. You need not specify the names of the Basic I/O functions For example:

copy
$
catalyst serve --debug advancedio:InvoiceFetch:2000,basicio:4000

This will start the local server at the default port 3000. The resources will be served and the local endpoints will be displayed. You can then attach the debugger at port 2000 for the Advanced I/O function, and port 4000 for the Basic I/O functions. The server will be listening at these ports for the debugger.

Catalyst Serve Options


After you see this message, open your IDE and attach the debugger to the ports you specified for the functions. The CLI will display a confirmation message after it is attached. You can now test your resources and debug them. The CLI will display the errors caught by the debugger, along with their details.


--proxy<url>

Catalyst enables you to proxy an unknown request to the localhost URL generated by the server in the CLI. This allows you to proxy the requests that are encountered during the serve of functions. Such requests will be proxied to the Catalyst console by default.

You can specify the URL to proxy the unknown requests to, while executing the serve command as follows:

copy
$
catalyst serve --proxy <url>

--only<targets>

You can serve specific targets instead of all the resources using this option. For example, you can serve specific functions, or the client package alone.

To serve specific targets, execute the catalyst serve command with the --only option followed by the targets to be served as shown below:

copy
$
catalyst serve --only client


Catalyst Serve Options


--no-watch

Catalyst CLI provides a live watch mode by default, which allows you to perform hot reload of the resources that are being served. This enables you to view the updates of the changes you make instantly, without having to re-compile or re-serve the code.

However, if you require the live watch mode to be disabled, you can do so using this option. You can use this option if you don’t have to make changes in the code, such as while serving a production-ready build, or if don’t require the updates to be reflected live.

You can serve resources with the default live watch disabled as shown below:

copy
$
catalyst serve --no-watch

This will make the server compile the code only when the code is served initially. The server will not watch for changes after the code is served. The updates will not be reflected live when you test the resources.

If you require the default live watch mode to be enabled again, you must exit the serve session, and re-serve the code without using this option.


--except<targets>

You can choose to exclude specific resources from being served using this option. For example, you can exclude specific functions or the client package.

To exclude a specific function, execute the catalyst serve command with the –except option followed by the target name as shown below:

copy
$
catalyst serve -- except functions:InvoiceGeneration

Catalyst Serve Options


--ignore-scripts

Catalyst enables you to automate the CLI and terminal command executions by defining scripts in the catalyst.json file in your project directory. You can define two lifecycle scripts to execute before and after the catalyst serve command respectively: preserve, postserve . You can learn more about the lifecycle and custom scripts from the Scripts help page .

If you use the –ignore-scripts option while executing the catalyst serve command, the CLI will ignore the actions configured for the preserve and postserve scripts in the catalyst.json file of your project directory. The deployment process will proceed without the execution of these lifecycle scripts.

You can use the –ignore-scripts option as follows:

copy
$
catalyst serve --ignore-scripts

The serving process will be the same as discussed earlier.


--no-open

When you execute the serve command and the server hosts the code, the CLI will redirect you to your default browser automatically to open the client component in your project. If you require this automatic redirection to be disabled, you can execute the serve command with this option as shown below:

copy
$
catalyst serve --no-open

The CLI will display the localhost URL of all the served components as usual. You can still open the web client manually by accessing the URL, if you require.

Catalyst Serve Options

You can use this option when you don’t require the client component to be tested, or while performing a test run of a production-ready build.

Last Updated 2023-05-09 17:07:05 +0530 +0530