Created
March 28, 2016 08:05
-
-
Save dai-shi/40f9e3037c61844e19c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index 0201eb4..234a839 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -4,6 +4,13 @@ import { check } from 'meteor/check'; | |
export const Tasks = new Mongo.Collection('tasks'); | |
+if (Meteor.isServer) { | |
+ // This code only runs on the server | |
+ Meteor.publish('tasks', function tasksPublication() { | |
+ return Tasks.find(); | |
+ }); | |
+} | |
+ | |
Meteor.methods({ | |
'tasks.insert'(text) { | |
check(text, String); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment