Vote count:
0
I just started fooling around with Meteor and I was wondering what kind of logic you position on the client in the manager-files and what kind of logic you position in the collections on the server. Can you explain this in general and maybe use the following example to explain further:
Consider the following collections:
- files: holds metadata about uploaded files
- users: holds information about the users of the app
- share: holds information about files that are shared between multiple users (each user has his own copy of the shared file)
Consider the following manager:
shares.js
Template.shareFile.events({
'click #share-file': function(event, template) {
// 1. look if the user who you want to share with exists
// 2. copy the file and add a new record in the 'files'-collection.
// The user who you want to share with becomes the owner of this file.
// 3. create a share-record that holds the link between the two files
}
});
Is it considered good programming to do the actions above in the manager or should I create a package for this or even maybe do this in the collection.
asked 26 secs ago
Aucun commentaire:
Enregistrer un commentaire