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 using the Catalyst CLI.

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

copy
$
catalyst serve

This Alien City application is now served at default port 3001.

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

catalyst_alcity_catalyst_serve

You can now open the application’s localhost URL in a browser to access the Alien City application. catalyst_alcity_catalyst_test_1

Let’s test the application by entering a city’s name and checking for the history of an alien encounter in the city. Because 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. catalyst_alcity_catalyst_test_2

A matching record for this city will not be found in the Data Store, and the application displays a negative response. catalyst_alcity_catalyst_test_3

Now, let’s report an alien encounter. Click the Report Alien Encounter tab. Enter a city name and click Report. We have entered “Monaco” in our application. catalyst_alcity_catalyst_test_4

The application will display a pop-up box confirming that the data has been added to the Data Store. catalyst_alcity_catalyst_test_5

You can verify this by opening your Catalyst console and navigating to Data Store under CloudScale. Click the Data View tab of the table to view the record that was just inserted. catalyst_alcity_catalyst_test_6

Next, let’s search for this city in the application and check if it fetches this record from the Data Store. Click the Check My City tab in the application and enter the name of the city that you just reported. Here, we enter “Monaco.” Click Check. catalyst_alcity_catalyst_test_7

The application displays a positive response.

You can also check if the application displays the duplication message by reporting the same city again. catalyst_alcity_catalyst_test_8

If this setup is working correctly, you can deploy the application.


Last Updated 2024-02-22 23:26:30 +0530 +0530

RELATED LINKS

Serve CLI Resources