在Iron Router / Iron Cli中使用流星的Collection FS

问题描述 投票:0回答:1

我一直在挠头,试图为我的Iron cli生成的项目改编fs系列。

Iron cli使用Iron Router。 这是我正在关注的教程https://medium.com/@victorleungtw/how-to-upload-files-with-meteor-js-7b8e811510fa#.mdionmurk

第一个片段

var imageStore = new FS.Store.GridFS(“images”);

Images = new FS.Collection(“images”, {
 stores: [imageStore]
});

第二个是拒绝/允许规则

Images.deny({
 insert: function(){
 return false;
 },
 update: function(){
 return false;
 },
 remove: function(){
 return false;
 },
 download: function(){
 return false;
 }
 });

Images.allow({
 insert: function(){
 return true;
 },
 update: function(){
 return true;
 },
 remove: function(){
 return true;
 },
 download: function(){
 return true;
 }
});

第一个代码段应该去哪里,第二个代码段应该去哪里?如果有人想知道iron-cli的结构,这就是https://github.com/iron-meteor/iron-cli的样子

meteor iron-router collectionfs
1个回答
0
投票

根据生成的结构,您的第一个代码段将进入app/lib/collections ,第二个代码片段将进入app/server/collections

© www.soinside.com 2019 - 2024. All rights reserved.