Skip to content

Instantly share code, notes, and snippets.

@harrisrobin
Created December 2, 2015 02:09
Show Gist options
  • Save harrisrobin/d13d10c73ad916c39731 to your computer and use it in GitHub Desktop.
Save harrisrobin/d13d10c73ad916c39731 to your computer and use it in GitHub Desktop.
Tasks = new Mongo.Collection("tasks");
if (Meteor.isClient) {
Template.body.helpers({
tasks: function () {
return Tasks.find({});
}
});
Template.body.events({
"submit .new-task": function(event) {
event.preventDefault();
console.log(event.target.text.value);
var task = {
title: event.target.text.value,
created_at: new Date()
};
Tasks.insert(task)
}
})
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment