Step 3: Adjust the Root Controller

The JavaScript sources should be generated through the view we just created. For this to work, we need a controller, which handles that. We can use the Root controller which was created when we created MyApp. Open up lib/MyApp/Controller/Root.pm and change the index subroutine to:

sub index :Path :Args(0) { }

This removes the Catalyst welcome message and a request to / will run the index template (which we will create later) via the TT view.

Step 4: Add the index Template

Now it's time to build some HTML and JavaScript. Add this to root/src/index: