Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save simpleprogrammer-shared/f14b7576450a44eda125d5ed22554632 to your computer and use it in GitHub Desktop.
Save simpleprogrammer-shared/f14b7576450a44eda125d5ed22554632 to your computer and use it in GitHub Desktop.
Getting Started With Meteor Tutorial (In the Cloud) 5
Items = new Meteor.Collection("items");
if (Meteor.isClient) {
Template.list.helpers({
items: function() {
return Items.find();
},
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
if(Items.find().count() == 0) {
var items = [
{ description: "Create Meteor app"},
{ description: "Buy an SSD"}
];
for(var i =0; i<items.length; i++) {
Items.insert(items[i]);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment