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.

To serve the Catalyst project locally, execute the following command from your project directory (CATALYST_PROJECT_HOME):

copy
$
catalyst serve

This Alien City application is now served at default port 3000. The local endpoint URLs of the components are displayed.

Note: Every time you access the homepage or any of the sub-pages of your client, or the function, the CLI will display a live log of the URL accessed, along with the HTTP request method.

alien-city-client

You can now open the client component’s local URL in a browser to access the Alien City application. alien-city-client

Let’s test the application by entering a city’s name and checking for the history of an alien encounter in the city. Since we have not reported an alien encounter in a city yet, the result should be negative.

Enter a city name in the text box and click Check.

alien-city-client

Since a matching record for this city is not found in the Data Store, the client displays a negative response. alien-city-client

Let’s now report an alien encounter. Click the Report Alien Encounter tab. Enter a city name and click Report. We have entered “Madrid” in our application. alien-city-client

The application will display a pop-up box confirming that the data is added to the Data Store. alien-city-client

You can verify this by opening your Catalyst console and navigating to Data Store under Develop. Click the Data View tab to view the record that was just inserted. alien-city-client

Let’s now search for this city in the client and check if it fetches this record from the Data Store. Click Check My City in the client application and enter the name of the city that you just reported. Here, we enter “Madrid”. Click Check.

alien-city-client

The client displays a positive response.

You can also check if the client displays the duplication message by reporting the same city again. alien-city-client

If this setup is working correctly, we can deploy the application to production.

Last Updated 2024-03-25 14:47:40 +0530 +0530

RELATED LINKS

Serve CLI Resources