Test the Application
Before you deploy the application to the remote console, you can test the application on a local server and check if everything works fine using the Catalyst CLI.
We will first test the cron function using the functions shell in the CLI, and then serve the Advanced I/O function and the client locally to test the frontend of the application.
To open the functions shell in your CLI, execute the following command from your project directory (CATALYST_PROJECT_HOME):
This will open the functions shell for the cron function in the CLI where you can test its execution.
To invoke the function, enter newsapp() in the shell and press Enter. This will make the API call to NewsAPI and fetch the news items from each category, and populate them in the Data Store.
The CLI will display the status of the function execution. The CLI will display the status of the function execution. You can exit the functions shell by killing the terminal command based on your local environment.
Now, let’s host the client component locally and check the frontend of the application.
To serve the Catalyst project locally, execute the following command from your project directory (CATALYST_PROJECT_HOME):
The news application will now be served at default port 3000. The local endpoint URLs of the components are displayed.
You can now open the application in a browser using the local URL of the client displayed in the CLI.
The news application displays the general news headlines in the index page. You can click a topic on the left to check the latest headlines in that category. You can open the original news article by clicking on a headline.
You can also open your Catalyst console to check the data populated in the tables in the Data Store. Click on a table’s name in the Data Store, and click Data View to check the records.
If this setup is working correctly, we can deploy the application to production.
You can quit the serve command session in your terminal by pressing Ctrl+C keys twice.
Last Updated 2023-12-15 18:54:08 +0530 +0530