Routing
Our next step is to create a routing system for our app. For those unfamiliar with routing, it's basically matching URL's with behaviour. So if URL equals x, then we want to show view y, etc. This will allow users navigate around our application without making trips to the server by taking advantage of browser HTML5 features like pushState or url hash fragments.
Having routes also allows for the use of the back button, which people instinctively use. I find it quite uncomfortable when I hit the back button in an app and it takes me to the previous website instead of the previous state of the application I was in.
Meteor doesn't come with its own routing system, but luckily there is a very good package called Iron Router:
"Iron.Router runs on the client and the server. You can define a route that only should run on the server, or a route that should only run on the client. Most of the time you'll create routes on the client. This makes your app really fast once it's loaded, because as you navigate around the application, you don't need to load an entirely new html page."
We will use Iron Router but be aware that other routing packages will likely appear as the Meteor community grows. For example, Flow Router is now gaining some traction.
We will create a menu and show/hide different templates depending on the URL. Basically, if we are on the /
(root) path, we will show the games
template, and on the /teams
path we will show the teams
template.