Chapter 8. Routing using Iron.Router

 

This chapter covers

  • Adding routing capabilities to Meteor applications
  • Creating layouts
  • Improving code structure using Iron.Router
  • Extending Iron.Router with controllers, hooks, and plug-ins
  • Creating server-side routes and APIs

As your application grows in size and complexity, you’ll have to deal with lots of subscriptions, publications, collections, and templates. You need a way to organize all these things as well as specify what to render and what data context should be available in the rendered templates.

One good approach to handling this complexity is to use routes. This means you decide what to subscribe to and what to render and you specify the data context, depending on unique URLs. The router handles all those tasks. The most commonly used package with Meteor is Iron.Router.

Iron.Router is a community package maintained by Chris Mather and Tom Coleman. Tom wrote one of the first routers for Meteor, called meteor-router, and Chris also started a routing project called meteor-mini-pages. Luckily for the Meteor community, they combined their efforts and developed a single router, which eventually became the Iron.Router package.

8.1. Routing in web applications

8.2. Client-side routing

8.3. Advanced routing methods

8.4. Server-side routing with a REST API

8.5. Summary

sitemap