Book Image

Building Single-page Web Apps with Meteor

By : Fabian Vogelsteller
Book Image

Building Single-page Web Apps with Meteor

By: Fabian Vogelsteller

Overview of this book

Table of Contents (21 chapters)
Building Single-page Web Apps with Meteor
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Adding another route


Having a front page doesn't make a real website. Let's add a link to our About page, which has been in our drawer since Chapter 2, Building HTML Templates.

To do this, just duplicate the Home route and change the values to create an About route, as follows:

Router.map(function() {
    
    this.route('Home', {
        path: '/',
        template: 'home'
    });
    this.route('About', {
        path: '/about',
        template: 'about'
    });
});

That's it!

Now, when we go back to our browser, we can click on the two links in the main menu to switch between our Home and About pages, and even typing in http://localhost:3000/about will bring us straight to the corresponding page, as shown in the following screenshot: