Search code examples
meteoriron-routercollectionfs

Using meteor's Collection FS in Iron Router / Iron Cli


I have been scratching my head while trying to adapt a collection fs for my iron cli generated project.

Iron cli uses iron router. This is the tutorial i am following https://medium.com/@victorleungtw/how-to-upload-files-with-meteor-js-7b8e811510fa#.mdionmurk

The first snippet

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

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

and the second is the deny/allow rules

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;
 }
});

Where should the first snippet go specifically and where should the second snippet go?.Incase anyone is wondering the structure of an iron-cli this is how it looks like https://github.com/iron-meteor/iron-cli


Solution

  • Based on the generated structure, your first snippet will go into app/lib/collections and your second will go into app/server/collections.