Tasks = new Mongo.Collection("tasks");


if (Meteor.isClient) {
  Tasks.insert({
    text: "yolo " + Math.floor(1000 * Math.random()),
    createdAt: new Date(),
  });

  Template.body.helpers({
    tasks: function() {
      return Tasks.find({}, {sort: {createdAt: -1}});
    }
  });
}

if (Meteor.isServer) {
  // Delete the messages with no date
  let old = Tasks.find({createdAt: {'$exists': false}}).fetch();
  for (var object of old) {
    Tasks.remove(object._id);
  }

  console.log('the server is running');
}

@@ -38,57 +38,63 @@
 ;%0A%0A%0A
-if (Meteor.isClient) %7B%0A  Tasks.insert(%7B%0A    text:
+function add(message) %7B%0A  if (!message) %7B%0A    message =
  %22yo
@@ -132,16 +132,56 @@
 andom())
+;%0A  %7D%0A  Tasks.insert(%7B%0A    text: message
 ,%0A    cr
@@ -207,16 +207,41 @@
 ,%0A  %7D);%0A
+%7D%0A%0Aif (Meteor.isClient) %7B
 %0A  Templ

create add helper function