Meteor - Building multi-page application

meteor

How can we build a multi-page web application with Meteor?

Because, when someone’s never built a web application before, it’s not immediately intuitive that creating a new page isn’t as simple as creating a new file. What I introduce them to, then, is the wide world of routing. Routing allows developers to make muti-page applications with less code and a flexible project structure. They have many other advantages, most of which become apparent as you build bigger and more complicated applications.

To handle this routing, the Iron Router package is the best option. Iron Router is everything — friendly, deep, and well-supported — and you can add it to a project with the following command:

meteor add iron:router

Once installed, create a route inside a JavaScript file:

this.route('about');

Then create a template of the same name:

<template name="about">
    <h1>About</h1>
</template>

You’ll now be able to visit the http://localhost:3000/about path and see the “about” template.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License