Contents
  1. 1. Flow Router
  2. 2. Publish data
  3. 3. 参考链接

Flow Router

1
2
3
4
5
6
7
8
9
FlowRouter.route('/dataSearch',{
subscriptions: function(params, queryParams) {
this.register('dataSearch', Meteor.subscribe('testdata'));
},
action: function() {
BlazeLayout.render("mainLayout",{content: "dataSearch"});
}

});

Publish data

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Testdata = new Mongo.Collection('testdata',{
idGeneration: 'MONGO'
});

if(Meteor.isServer){
//指定访问权限
var db_str = {
'insert' : (userId, doc) => {
return true;//true if you want, else false
}
, 'remove' : (userId, doc) => {
return true;
}
'update' : (userId, doc) => {
return true;
}
};

Testdata.allow(db_str);
Meteor.publish('testdata', function tasksPublication() {
return Testdata.find();
});

}

参考链接

  1. FlowRouter-中文文档
Contents
  1. 1. Flow Router
  2. 2. Publish data
  3. 3. 参考链接