Originally published at: http://www.sitepoint.com/6-must-use-meteor-packages-almost-every-project/
There are already thousands of packages for the Meteor JavaScript framework, so no matter what feature you want to add to your web application, someone’s probably gone ahead and made a package that slickly implements that precise ideas. Convenient, right?
But of course, with more choice comes the paradox of choice. It can be overwhelming to figure out which packages might come in handy.
Here’s a run-down of what I consider to be the few most helpful:
1. Iron Router
A question I’ve received a few times from beginning developers is, “How do I create a multi-page 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, but for the moment, there’s two main points to understand:
- The vast majority of Meteor applications will use routing in some way.
- 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.
This, however, is a very simple example of routing. For a deeper introduction, watch this video I made for Learnable.
2. Collection2
Most Meteor applications will interact with a database in some way. By default though, you’ll have to manually validate the data that users are inserting, editing, and removing from the database.
Collection2 helps with this process by extending Meteor’s functionality, allowing it to “provide support for specifying a schema and then validating against that schema when inserting and updating.” For example, you can make it so a “Books” collection has a title
field that must be a string, and a lastCheckedOut
field that must be a date.
Here’s an example schema:
Continue reading this article on SitePoint