Skip to content

Instantly share code, notes, and snippets.

@varavut
Last active January 24, 2016 12:25
Show Gist options
  • Save varavut/aa99bf343dba1fff1e66 to your computer and use it in GitHub Desktop.
Save varavut/aa99bf343dba1fff1e66 to your computer and use it in GitHub Desktop.
Meteor.methods({
'Threads.create': function (title) {
if (!this.userId)
throw new Meteor.Error('Unauthorized', 'Please login before perform an action');
check(title, String);
Threads.insert({
title: title,
owner: this.userId,
createdAt: new Date(),
updatedAt: new Date()
});
return { message: 'Threads.create OK' };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment