This allows you to include your js files and it will instantiate the correct javascript package/class based on the route you have in your config. this is helpful in frameworks where you don't really want to have to instantiate a different class for each page, and forces everyone to use correct packaging and naming conventions based on the controller / view you are currently on. It also allows you to have a default page, in this case AppPage which gets instantiate if there is no javascript controller class present.